diff --git a/adult_smile.tgz b/adult_smile.tgz deleted file mode 100644 index 04ef72fb..00000000 Binary files a/adult_smile.tgz and /dev/null differ diff --git a/adult_smile/adult_smile.php b/adult_smile/adult_smile.php deleted file mode 100644 index 46574143..00000000 --- a/adult_smile/adult_smile.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * 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'][] = '' . '(o)(o)' . ''; - - $b['texts'][] = '(.)(.)'; - $b['icons'][] = '' . '(.)(.)' . ''; - - $b['texts'][] = ':bong'; - $b['icons'][] = '' . ':bong' . ''; - - -} \ No newline at end of file diff --git a/communityhome.tgz b/communityhome.tgz index b08f2e56..dbb235bb 100755 Binary files a/communityhome.tgz and b/communityhome.tgz differ diff --git a/communityhome/communityhome.php b/communityhome/communityhome.php index 8f0aa867..14c40328 100755 --- a/communityhome/communityhome.php +++ b/communityhome/communityhome.php @@ -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` diff --git a/communityhome/twillingham/README b/communityhome/twillingham/README index bb574278..dbbe1419 100644 --- a/communityhome/twillingham/README +++ b/communityhome/twillingham/README @@ -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. \ No newline at end of file diff --git a/facebook.tgz b/facebook.tgz index 1d1919d2..c4cc196b 100644 Binary files a/facebook.tgz and b/facebook.tgz differ diff --git a/facebook/README b/facebook/README index 9687558e..b68ba3da 100755 --- a/facebook/README +++ b/facebook/README @@ -1,35 +1,43 @@ 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 - $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 - 'Remove Facebook posting'. +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. + + +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 and images will be converted to a format suitable for the Facebook API and diff --git a/facebook/facebook.php b/facebook/facebook.php index 9f873284..1849cef3 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -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.

'); + + $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).') . '
'; + elseif (is_array($subs)) { + $o .= t('The given API Key seems to work correctly.') . '
'; + $working_connection = true; + } else $o .= t('The correctness of the API Key could not be detected. Somthing strange\'s going on.') . '
'; + } $o .= '
'; $o .= '
'; + $o .= '
'; $o .= ''; - if ($appid && $appsecret) { + if ($working_connection) { $o .= '

' . t('Real-Time Updates') . '

'; $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(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches)) - $image = $matches[1]; + 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 - - $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;*/ + $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 ((strlen($msg) > FACEBOOK_MAXPOSTLEN) or $toolong) { + // 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); + } + } + + // 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,7 +974,19 @@ function facebook_post_hook(&$a,&$b) { $msg = substr($msg, 0, FACEBOOK_MAXPOSTLEN - strlen($shortlink) - 4); $msg .= '... ' . $shortlink; } - if(! strlen($msg)) + + // 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; logger('Facebook post: msg=' . $msg, LOGGER_DATA); @@ -1222,8 +1290,14 @@ function fb_consume_stream($uid,$j,$wall = false) { // don't store post if we don't have a contact if(! x($datarray,'contact-id')) { - logger('no contact: post ignored'); - continue; + 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; @@ -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) { diff --git a/impressum.tgz b/impressum.tgz index 4f8ab29f..b2f83119 100755 Binary files a/impressum.tgz and b/impressum.tgz differ diff --git a/impressum/README b/impressum/README index 3f183fbf..bea55db2 100755 --- a/impressum/README +++ b/impressum/README @@ -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 - * $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 + 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 diff --git a/nsfw.tgz b/nsfw.tgz index b7caadbd..6897cb89 100755 Binary files a/nsfw.tgz and b/nsfw.tgz differ diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index a5b3ede1..0f94158b 100755 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -44,13 +44,13 @@ function nsfw_addon_settings(&$a,&$s) { $words = 'nsfw,'; $s .= '
'; - $s .= '

' . t('"Not Safe For Work" Settings') . '

'; + $s .= '

' . t('Not Safe For Work (General Purpose Content Filter) settings') . '

'; $s .= '
'; - - $s .= ''; + $s .= '

' . 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.') . '

'; + $s .= ''; $s .= ''; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; diff --git a/openstreetmap.tgz b/openstreetmap.tgz index 64a55d81..c7265d16 100644 Binary files a/openstreetmap.tgz and b/openstreetmap.tgz differ diff --git a/openstreetmap/README b/openstreetmap/README index 41fc842c..beac3a21 100644 --- a/openstreetmap/README +++ b/openstreetmap/README @@ -16,15 +16,33 @@ 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'; The *tmsserver* 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 with *zoom*. 1 will show the whole world and 18 is the highest -zoom level available. +with protocol (http/s) and trailing slash. You can configure the default zoom +level on the map with *zoom*. 1 will show the whole world and 18 is the highest +zoom level available. \ No newline at end of file diff --git a/smiley_pack.tgz b/smiley_pack.tgz index 384c6b9b..7ef9d884 100644 Binary files a/smiley_pack.tgz and b/smiley_pack.tgz differ diff --git a/smiley_pack/icons/disgust/fart.gif b/smiley_pack/icons/disgust/fart.gif deleted file mode 100644 index 4160a1fc..00000000 Binary files a/smiley_pack/icons/disgust/fart.gif and /dev/null differ diff --git a/smiley_pack/smiley_pack.php b/smiley_pack/smiley_pack.php index d85f9b5e..7f4bfb7b 100644 --- a/smiley_pack/smiley_pack.php +++ b/smiley_pack/smiley_pack.php @@ -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'); } diff --git a/smilies_adult.tgz b/smilies_adult.tgz new file mode 100644 index 00000000..e4e86ba2 Binary files /dev/null and b/smilies_adult.tgz differ diff --git a/adult_smile/icons/bong.gif b/smilies_adult/icons/bong.gif similarity index 100% rename from adult_smile/icons/bong.gif rename to smilies_adult/icons/bong.gif diff --git a/adult_smile/icons/drunk.gif b/smilies_adult/icons/drunk.gif similarity index 100% rename from adult_smile/icons/drunk.gif rename to smilies_adult/icons/drunk.gif diff --git a/adult_smile/icons/sperm.gif b/smilies_adult/icons/sperm.gif similarity index 100% rename from adult_smile/icons/sperm.gif rename to smilies_adult/icons/sperm.gif diff --git a/adult_smile/icons/tits.gif b/smilies_adult/icons/tits.gif similarity index 100% rename from adult_smile/icons/tits.gif rename to smilies_adult/icons/tits.gif diff --git a/smilies_adult/smilies_adult.php b/smilies_adult/smilies_adult.php new file mode 100644 index 00000000..fd6928be --- /dev/null +++ b/smilies_adult/smilies_adult.php @@ -0,0 +1,38 @@ + + * + * 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'][] = '' . '(o)(o)' . ''; + + $b['texts'][] = '(.)(.)'; + $b['icons'][] = '' . '(.)(.)' . ''; + + $b['texts'][] = ':bong'; + $b['icons'][] = '' . ':bong' . ''; + + $b['texts'][] = ':sperm'; + $b['icons'][] = '' . ':sperm' . ''; + + $b['texts'][] = ':drunk'; + $b['icons'][] = '' . ':drunk' . ''; +} \ No newline at end of file diff --git a/twitter.tgz b/twitter.tgz index 68a412aa..54d6f8b5 100755 Binary files a/twitter.tgz and b/twitter.tgz differ diff --git a/twitter/README b/twitter/README index a5511fec..3b8f0e85 100755 --- a/twitter/README +++ b/twitter/README @@ -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, ..." + +$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. + diff --git a/wppost.tgz b/wppost.tgz index 22194335..b07bf6e0 100755 Binary files a/wppost.tgz and b/wppost.tgz differ diff --git a/wppost/wppost.php b/wppost/wppost.php index 264a342c..28e4e369 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -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 = '' . (($b['title']) ? $b['title'] : t('Post from Friendica')) . ''; $post = $title . bbcode($b['body']);