Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master: (24 commits)
  Remove tilde files
  Tobias outlined a rare situation where a site admin may not have an admin account, and will therefore need to do things in .htconfig.php
  .
  more wrong name
  add renamed package
  dash in filename won't work with plugins
  smilies_adult install issue after rename, package updates
  deleted:    adult_smile/adult_smile.php 	modified:   smiley_pack/smiley_pack.php 	renamed:    adult_smile/icons/bong.gif -> smilies-adult/icons/bong.gif 	renamed:    adult_smile/icons/drunk.gif -> smilies-adult/icons/drunk.gif 	renamed:    adult_smile/icons/sperm.gif -> smilies-adult/icons/sperm.gif 	renamed:    adult_smile/icons/tits.gif -> smilies-adult/icons/tits.gif 	new file:   smilies-adult/smilies-adult.php
  Brought readme up to date
  Brought readme up to date
  Brought readme up to date
  Brought README up to date.
  Changed the README for my variant, and changed "Last" users/likes/posts to Latest users/likes/posts.
  Improved nsfw/content filter
  Reworded the UI of NSFW to make it more obviously a general purpose content filter
  Facebook: Design issues in the export
  Migration hint: the form cannot be used as long as the settings are set in .htconfig.php, so tell this to the administrator.
  Check if the given AppID/Secret works. Make the polling interval configurable.
  wppost: Mechanism for guessing the title added
  facebook: If the body is empty then the link is taken.
  ...

* master:
This commit is contained in:
Simon L'nu 2012-04-06 03:54:44 -04:00
commit 717d744e62
27 changed files with 261 additions and 128 deletions

Binary file not shown.

View file

@ -1,34 +0,0 @@
<?php
/*
* Name: Adult Smilies
* Description: Smily icons that could or should not be included in core
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*
* This is a template for how to extend the "smily" code.
*
*/
function adult_smile_install() {
register_hook('smilie', 'addon/adult_smile/adult_smile.php', 'adult_smile_smilies');
}
function adult_smile_uninstall() {
unregister_hook('smilie', 'addon/adult_smile/adult_smile.php', 'adult_smile_smilies');
}
function adult_smile_smilies(&$a,&$b) {
$b['texts'][] = '(o)(o)';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/adult_smile/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />';
$b['texts'][] = '(.)(.)';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/adult_smile/icons/tits.gif' . '" alt="' . '(.)(.)' . '" />';
$b['texts'][] = ':bong';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/adult_smile/icons/bong.gif' . '" alt="' . ':bong' . '" />';
}

Binary file not shown.

View file

@ -35,7 +35,7 @@ function communityhome_home(&$a, &$o){
$aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
// last 12 users
$aside['$lastusers_title'] = t('Last users');
$aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
@ -95,7 +95,7 @@ function communityhome_home(&$a, &$o){
}
// last 12 photos
$aside['$photos_title'] = t('Last photos');
$aside['$photos_title'] = t('Latest photos');
$aside['$photos_items'] = array();
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
@ -130,7 +130,7 @@ function communityhome_home(&$a, &$o){
}
// last 10 liked items
$aside['$like_title'] = t('Last likes');
$aside['$like_title'] = t('Latest likes');
$aside['$like_items'] = array();
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`

View file

@ -1,7 +1,3 @@
Thomas Willingham
This is a variant of the community home. Instead of displaying the community tab in the front page, we still use home.html, but we also add the latest users to the sidebar.
This isn't even close to being worth a pull request, but some people might find it useful.
Enable community home in your admin panel, then replace communityhome.php with this one to get a front page like mine (a normal front page, but with latest users shown in the sidebar, which looks bleak when there's nothing in it).
There are more graceful ways of doing this, I used communityhome as I plan to make use of a limited stream and likes in future.
Simply replace addon/communityhome/communityhome.php with this version then enable community home in your admin panel as usual.

Binary file not shown.

View file

@ -1,34 +1,42 @@
Installing the Friendica/Facebook connector
1. register an API key for your site from developer.facebook.com
a. We'd be very happy if you include "Friendica" in the application name
to increase name recognition. The Friendica icons are also present
in the images directory and may be uploaded as a Facebook app icon.
Use images/friendica-16.jpg for the Icon and images/friendica-128.jpg for the Logo.
b. The url should be your site URL with a trailing slash.
You may use http://portal.friendika.com/privacy as the privacy policy
URL unless your site has different requirements, and
http://portal.friendika.com as the Terms of Service URL unless
you have different requirements. (Friendica is a software application
and does not require Terms of Service, though your installation of it might).
c. Set the following values in your .htconfig.php file
1. Visit https://developers.facebook.com/apps to register an app.
a) Click "Create a new app"
b) We'd be very happy if you include "Friendica" in the application name
to increase name recognition.
c) Edit your app settings on the setup page. The Friendica icons are present
in the images directory and may be uploaded as a Facebook app icon. Use
images/friendica-16.jpg for the Icon and images/Friendica-128.jpg for the logo.
d) In the App Display name enter the name of your app (this should default to the
name you chose in part a).
e) Enter YourDomain.com in the App Domain field and hit return.
f) In "Select how your app connects with Facebook select "Website" and enter the
full URL to your Friendica install including HTTPS and a trailing slash.
2. Enable the Facebook plugin by clicking on the icon next to it's name on the plugin
page of your admin panel.
b) return to the Facebook plugin page in your admin panel, and fill in the App-ID
and Application Secret settings you got from Facebook.
c) Click save.
d) Finally, return to the Facebook settings page, and activate real-time updates.
i. If you for any reason prefer to use a configuration file instead of the admin panels,
Activate the plugin by including it in .htconfig.php, e.g.
$a->config['system']['addon'] = 'plugin1,plugin2,facebook';
and set the following values:
$a->config['facebook']['appid'] = 'xxxxxxxxxxx';
$a->config['facebook']['appsecret'] = 'xxxxxxxxxxxxxxx';
Replace with the settings Facebook gives you.
d. Navigate to Set Web->Site URL & Domain -> Website Settings. Set Site URL
to yoursubdomain.yourdomain.com. Set Site Domain to your yourdomain.com.
e. Chose "Website" (the url should be your site URL with a trailing slash) in the
"Select how your app integrates with Facebook" section.
2. Enable the facebook plugin by including it in .htconfig.php - e.g.
$a->config['system']['addon'] = 'plugin1,plugin2,facebook';
3. Visit the Facebook Settings section of the "Settings->Plugin Settings" page.
and click 'Install Facebook Connector'.
4. This will ask you to login to Facebook and grant permission to the
plugin to do its stuff. Allow it to do so.
5. Optional step: If you want to use Facebook Real Time Updates (so new messages
and new contacts are added ~1min after they are postet / added on FB), go to
Settings -> plugins -> facebook and press the "Activate Real-Time Updates"-button.
6. You're done. To turn it off visit the Plugin Settings page again and
3. To use the Facebook plugin, visit the "connector settings" area of your settings
page. Click "Install Facebook Connector".
4. This will ask you to login to Facebook and allow the plugin to do it's stuff.
Allow it to do so.
5. You're done. To turn it off visit the Plugin Settings page again and
'Remove Facebook posting'.
Vidoes and embeds will not be posted if there is no other content. Links

View file

@ -25,9 +25,8 @@
* d. Navigate to Set Web->Site URL & Domain -> Website Settings. Set
* Site URL to yoursubdomain.yourdomain.com. Set Site Domain to your
* yourdomain.com.
* 2. (This step is now obsolete. Enable the plugin via the Admin panel.)
* Enable the facebook plugin by including it in .htconfig.php - e.g.
* $a->config['system']['addon'] = 'plugin1,plugin2,facebook';
* 2. Visit the Facebook Settings section of the "Settings->Plugin Settings" page.
* and click 'Install Facebook Connector'.
* 3. Visit the Facebook Settings section of the "Settings->Plugin Settings" page.
* and click 'Install Facebook Connector'.
* 4. This will ask you to login to Facebook and grant permission to the
@ -50,11 +49,15 @@
/** TODO
* - Implement a method for the administrator to delete all configuration data the plugin has created,
* e.g. the app_access_token
* - Implement a configuration option to set the polling interval system-wide
*/
define('FACEBOOK_MAXPOSTLEN', 420);
// Size of maximum post length increased
// see http://www.facebook.com/schrep/posts/203969696349811
// define('FACEBOOK_MAXPOSTLEN', 420);
define('FACEBOOK_MAXPOSTLEN', 63206);
define('FACEBOOK_SESSION_ERR_NOTIFICATION_INTERVAL', 259200); // 3 days
define('FACEBOOK_DEFAULT_POLL_INTERVAL', 60); // given in minutes
define('FACEBOOK_MIN_POLL_INTERVAL', 5);
function facebook_install() {
@ -555,7 +558,7 @@ function facebook_cron($a,$b) {
$poll_interval = intval(get_config('facebook','poll_interval'));
if(! $poll_interval)
$poll_interval = 3600;
$poll_interval = FACEBOOK_DEFAULT_POLL_INTERVAL;
if($last) {
$next = $last + $poll_interval;
@ -647,12 +650,29 @@ function facebook_plugin_admin(&$a, &$o){
$appid = get_config('facebook', 'appid' );
$appsecret = get_config('facebook', 'appsecret' );
$poll_interval = get_config('facebook', 'poll_interval' );
if (!$poll_interval) $poll_interval = FACEBOOK_DEFAULT_POLL_INTERVAL;
$ret1 = q("SELECT `v` FROM `config` WHERE `cat` = 'facebook' AND `k` = 'appid' LIMIT 1");
$ret2 = q("SELECT `v` FROM `config` WHERE `cat` = 'facebook' AND `k` = 'appsecret' LIMIT 1");
if ((count($ret1) > 0 && $ret1[0]['v'] != $appid) || (count($ret2) > 0 && $ret2[0]['v'] != $appsecret)) $o .= t('Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>');
$working_connection = false;
if ($appid && $appsecret) {
$subs = facebook_subscriptions_get();
if ($subs === null) $o .= t('Error: the given API Key seems to be incorrect (the application access token could not be retrieved).') . '<br>';
elseif (is_array($subs)) {
$o .= t('The given API Key seems to work correctly.') . '<br>';
$working_connection = true;
} else $o .= t('The correctness of the API Key could not be detected. Somthing strange\'s going on.') . '<br>';
}
$o .= '<label for="fb_appid">' . t('App-ID / API-Key') . '</label><input name="appid" type="text" value="' . escape_tags($appid ? $appid : "") . '"><br style="clear: both;">';
$o .= '<label for="fb_appsecret">' . t('Application secret') . '</label><input name="appsecret" type="text" value="' . escape_tags($appsecret ? $appsecret : "") . '"><br style="clear: both;">';
$o .= '<label for="fb_poll_interval">' . sprintf(t('Polling Interval (min. %1$s minutes)'), FACEBOOK_MIN_POLL_INTERVAL) . '</label><input name="poll_interval" type="number" min="' . FACEBOOK_MIN_POLL_INTERVAL . '" value="' . $poll_interval . '"><br style="clear: both;">';
$o .= '<input type="submit" name="fb_save_keys" value="' . t('Save') . '">';
if ($appid && $appsecret) {
if ($working_connection) {
$o .= '<h4>' . t('Real-Time Updates') . '</h4>';
$activated = facebook_check_realtime_active();
@ -671,6 +691,8 @@ function facebook_plugin_admin_post(&$a, &$o){
if (x($_REQUEST,'fb_save_keys')) {
set_config('facebook', 'appid', $_REQUEST['appid']);
set_config('facebook', 'appsecret', $_REQUEST['appsecret']);
$poll_interval = IntVal($_REQUEST['poll_interval']);
if ($poll_interval >= FACEBOOK_MIN_POLL_INTERVAL) set_config('facebook', 'poll_interval', $poll_interval);
del_config('facebook', 'app_access_token');
info(t('The new values have been saved.'));
}
@ -828,6 +850,7 @@ function facebook_post_hook(&$a,&$b) {
if($b['verb'] == ACTIVITY_DISLIKE)
$msg = trim(strip_tags(bbcode($msg)));
// Old code
/*$search_str = $a->get_baseurl() . '/search';
if(preg_match("/\[url=(.*?)\](.*?)\[\/url\]/is",$msg,$matches)) {
@ -859,23 +882,47 @@ function facebook_post_hook(&$a,&$b) {
$msg = trim(strip_tags(bbcode($msg)));*/
// Test
// New code
// Looking for images
// Looking for the first image
$image = '';
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$b['body'],$matches))
$image = $matches[3];
if ($image != '')
if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
$image = $matches[1];
$html = bbcode($b['body']);
$msg = trim($b['title']." \n".html2plain($html, 0, true));
// Checking for a bookmark element
$body = $b['body'];
if (strpos($body, "[bookmark") !== false) {
// splitting the text in two parts:
// before and after the bookmark
$pos = strpos($body, "[bookmark");
$body1 = substr($body, 0, $pos);
$body2 = substr($body, $pos);
// Removing the bookmark and all quotes after the bookmark
// they are mostly only the content after the bookmark.
$body2 = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'',$body2);
$body2 = preg_replace("/\[quote\=([^\]]*)\](.*?)\[\/quote\]/ism",'',$body2);
$body2 = preg_replace("/\[quote\](.*?)\[\/quote\]/ism",'',$body2);
$body = $body1.$body2;
}
// At first convert the text to html
$html = bbcode($body);
// Then convert it to plain text
$msg = trim($b['title']." \n\n".html2plain($html, 0, true));
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
$toolong = false;
// Removing multiple newlines
while (strpos($msg, "\n\n\n") !== false)
$msg = str_replace("\n\n\n", "\n\n", $msg);
// add any attachments as text urls
$arr = explode(',',$b['attach']);
if(count($arr)) {
@ -889,19 +936,28 @@ function facebook_post_hook(&$a,&$b) {
}
}
// To-Do: look for bookmark-bbcode and handle it with priority
$link = '';
$linkname = '';
// look for bookmark-bbcode and handle it with priority
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches)) {
$link = $matches[1];
$linkname = $matches[2];
}
// If there is no bookmark element then take the first link
if ($link == '') {
$links = collecturls($html);
if (sizeof($links) > 0) {
reset($links);
$link = current($links);
/*if (strlen($msg."\n".$link) <= FACEBOOK_MAXPOSTLEN)
$msg .= "\n".$link;
else
$toolong = true;*/
}
}
if ((strlen($msg) > FACEBOOK_MAXPOSTLEN) or $toolong) {
// Remove trailing and leading spaces
$msg = trim($msg);
// Since facebook increased the maxpostlen massively this never should happen again :)
if (strlen($msg) > FACEBOOK_MAXPOSTLEN) {
$shortlink = "";
require_once('library/slinky.php');
@ -918,6 +974,18 @@ function facebook_post_hook(&$a,&$b) {
$msg = substr($msg, 0, FACEBOOK_MAXPOSTLEN - strlen($shortlink) - 4);
$msg .= '... ' . $shortlink;
}
// Fallback - if message is empty
if(!strlen($msg))
$msg = $link;
if(!strlen($msg))
$msg = $image;
if(!strlen($msg))
$msg = $linkname;
// If there is nothing to post then exit
if(!strlen($msg))
return;
@ -1222,9 +1290,15 @@ function fb_consume_stream($uid,$j,$wall = false) {
// don't store post if we don't have a contact
if(! x($datarray,'contact-id')) {
if (get_config('facebook', 'pages')) {
// If no user is found then post it under the own id.
// Definitely a quickhack
$datarray['contact-id'] = $self[0]['id'];
} else {
logger('no contact: post ignored');
continue;
}
}
$datarray['verb'] = ACTIVITY_POST;
if($wall) {
@ -1511,7 +1585,7 @@ function facebook_subscription_del_users() {
$url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token;
facebook_delete_url($url);
del_config('facebook', 'realtime_active');
if (!facebook_check_realtime_active()) del_config('facebook', 'realtime_active');
}
function facebook_subscription_add_users($second_try = false) {

Binary file not shown.

View file

@ -12,16 +12,20 @@ About
In the notes and postal fields you can use HTML tags for formatting.
Configuration:
For configuration you can set the following variables in the .htconfig file
Simply fill in the fields in the impressium settings page in the plugins area
of your admin panel.
If you for any reason prefer to use a configuration file instead, you can set the
following variables in the .htconfig file
* $a->config['impressum']['owner'] this is the Name of the Operator
* $a->config['impressum']['ownerprofile'] this is an optional Friendica account
where the above owner name will link to
* $a->config['impressum']['email'] a contact email address (optional)
will be displayed slightly obfuscated
as name(at)example(dot)com
* $a->config['impressum']['postal'] should contain a postal address where
you can be reached at (optional)
* $a->config['impressum']['notes'] additional informations that should
be displayed in the Impressum block

BIN
nsfw.tgz

Binary file not shown.

View file

@ -44,13 +44,13 @@ function nsfw_addon_settings(&$a,&$s) {
$words = 'nsfw,';
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('"Not Safe For Work" Settings') . '</h3>';
$s .= '<h3>' . t('Not Safe For Work (General Purpose Content Filter) settings') . '</h3>';
$s .= '<div id="nsfw-wrapper">';
$s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . t('Enable NSFW filter') . ' </label>';
$s .= '<p>' . t ('This plugin looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter.') . '</p>';
$s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . t('Enable Content filter') . ' </label>';
$s .= '<input id="nsfw-enable" type="checkbox" name="nsfw-enable" value="1"' . $enable_checked . ' />';
$s .= '<div class="clear"></div>';
$s .= '<label id="nsfw-label" for="nsfw-words">' . t('Comma separated words to treat as NSFW') . ' </label>';
$s .= '<label id="nsfw-label" for="nsfw-words">' . t('Comma separated list of keywords to hide') . ' </label>';
$s .= '<input id="nsfw-words" type="text" name="nsfw-words" value="' . $words .'" />';
$s .= '</div><div class="clear"></div>';

Binary file not shown.

View file

@ -16,11 +16,29 @@ Support the OpenStreetMap community and share the load.
___ Configuration ___
If you for any reason prefer to use a configuration file instead
of the admin panels, please refer to the Alternative Configuration below.
Activate the plugin from your admin panel.
You can now add a Tile Server and default zoom level in the plugin settings
page of your admin panel.
The Time Server URL points to the tile server you want to use. Use the full URL,
with protocol (http/s) and trailing slash. You can configure the default zoom
level on the map in the Default Zoom box. 1 will show the whole world and 18 is the highest
zoom level available.
___ Alternative Configuration ___
Open the .htconfig.php file and add "openstreetmap" to the list of activated
addons.
$a->config['system']['addon'] = "openstreetmap, ..."
You have to add two configuration variables for the addon:
$a->config['openstreetmap']['tmsserver'] = 'http://www.openstreetmap.org/';
$a->config['openstreetmap']['zoom'] = '18';

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View file

@ -13,7 +13,7 @@ function smiley_pack_install() {
register_hook('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies');
}
function smiley_pack__uninstall() {
function smiley_pack_uninstall() {
unregister_hook('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies');
}

BIN
smilies_adult.tgz Normal file

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 648 B

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 696 B

View file

@ -0,0 +1,38 @@
<?php
/*
* Name: Adult Smilies
* Description: Smily icons that could or should not be included in core
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*
* This is a template for how to extend the "smily" code.
*
*/
function smilies_adult_install() {
register_hook('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies');
}
function smilies_adult_uninstall() {
unregister_hook('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies');
}
function smilies_adult_smilies(&$a,&$b) {
$b['texts'][] = '(o)(o)';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />';
$b['texts'][] = '(.)(.)';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(.)(.)' . '" />';
$b['texts'][] = ':bong';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/bong.gif' . '" alt="' . ':bong' . '" />';
$b['texts'][] = ':sperm';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/sperm.gif' . '" alt="' . ':sperm' . '" />';
$b['texts'][] = ':drunk';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/drunk.gif' . '" alt="' . ':drunk' . '" />';
}

Binary file not shown.

View file

@ -48,20 +48,30 @@ ___ Configuration ___
__ Global Configuration __
If you enabled an administrator account, please use the admin panel to cofigure
the Twitter relay.
the Twitter relay. If you for any reason prefer to use a configuration file instead
of the admin panels, please refer to the Alternative Configuration below.
To activate this addon add @twitter@ to the list of active addons in your
Activate the plugin from the plugins section of your admin panel. When you have
done so, add your consumer key and consumer secret in the settings section of the
plugin page.
When this is done your user can now configure their Twitter connection at
"Settings -> Plugin Settings" and enable the forwarding of their *public*
messages to Twitter.
__ Alternative Configuration __
-To activate this addon add @twitter@ to the list of active addons in your
.htconfig.php file
$a->config['system']['addon'] = "twitter, ..."
Afterwards you need to add your OAuth consumer key / secret pair to it by
adding the following two lines
$a->config['twitter']['consumerkey'] = 'your consumer KEY here';
$a->config['twitter']['consumersecret'] = 'your consumer SECRET here';
When this is done your user can now configure their Twitter connection at
"Settings -> Plugin Settings" and enable the forwarding of their *public*
messages to Twitter.
__ User Configuration __
@ -78,3 +88,4 @@ on the "Plugin Settings" page displaying two check boxes. One to enable/disable
the forwarding of *all public* postings to Twitter and one to clear the
personal configuration from the Twitter credentials.

Binary file not shown.

View file

@ -168,6 +168,24 @@ function wppost_send(&$a,&$b) {
if($wp_username && $wp_password && $wp_blog) {
require_once('include/bbcode.php');
require_once('include/html2plain.php');
// If the title is empty then try to guess
if ($b['title'] == '') {
// Take the description from the bookmark
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches))
$b['title'] = $matches[2];
// If no bookmark is found then take the first line
if ($b['title'] == '') {
$title = html2plain(bbcode($b['body']), 0, true);
$pos = strpos($title, "\n");
if (($pos == 0) or ($pos > 60))
$pos = 60;
$b['title'] = substr($title, 0, $pos);
}
}
$title = '<title>' . (($b['title']) ? $b['title'] : t('Post from Friendica')) . '</title>';
$post = $title . bbcode($b['body']);