Merge branch '3.6-rc'

This commit is contained in:
Tobias Diekershoff 2018-03-23 08:00:37 +01:00
commit 39dd3dffe0
733 changed files with 10943 additions and 8237 deletions

View file

@ -5,4 +5,4 @@ Please register an app at [http://bufferapp.com/developers/api](http://bufferapp
Please use (your server address)/buffer/connect as Callback URL.
After the registration please enter the values for "Client ID" and "Client Secret" in the
[administration](admin/plugins/buffer).
[administration](admin/addons/buffer).

View file

@ -5,22 +5,30 @@
* Version: 0.2
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
*/
require('addon/buffer/bufferapp.php');
require 'addon/buffer/bufferapp.php';
use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
function buffer_install() {
register_hook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
register_hook('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
register_hook('jot_networks', 'addon/buffer/buffer.php', 'buffer_jot_nets');
register_hook('connector_settings', 'addon/buffer/buffer.php', 'buffer_settings');
register_hook('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post');
Addon::registerHook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
Addon::registerHook('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
Addon::registerHook('jot_networks', 'addon/buffer/buffer.php', 'buffer_jot_nets');
Addon::registerHook('connector_settings', 'addon/buffer/buffer.php', 'buffer_settings');
Addon::registerHook('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post');
}
function buffer_uninstall() {
unregister_hook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
unregister_hook('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
unregister_hook('jot_networks', 'addon/buffer/buffer.php', 'buffer_jot_nets');
unregister_hook('connector_settings', 'addon/buffer/buffer.php', 'buffer_settings');
unregister_hook('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post');
Addon::unregisterHook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
Addon::unregisterHook('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
Addon::unregisterHook('jot_networks', 'addon/buffer/buffer.php', 'buffer_jot_nets');
Addon::unregisterHook('connector_settings', 'addon/buffer/buffer.php', 'buffer_settings');
Addon::unregisterHook('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post');
}
function buffer_module() {}
@ -28,7 +36,7 @@ function buffer_module() {}
function buffer_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
notice(L10n::t('Permission denied.') . EOL);
return '';
}
@ -50,28 +58,30 @@ function buffer_content(&$a) {
return $o;
}
function buffer_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/buffer/" );
function buffer_addon_admin(&$a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/buffer/");
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
'$client_id' => array('client_id', t('Client ID'), get_config('buffer', 'client_id' ), ''),
'$client_secret' => array('client_secret', t('Client Secret'), get_config('buffer', 'client_secret' ), ''),
));
$o = replace_macros($t, [
'$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values]
'$client_id' => ['client_id', L10n::t('Client ID'), Config::get('buffer', 'client_id'), ''],
'$client_secret' => ['client_secret', L10n::t('Client Secret'), Config::get('buffer', 'client_secret'), ''],
]);
}
function buffer_plugin_admin_post(&$a){
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
$client_secret = ((x($_POST,'client_secret')) ? notags(trim($_POST['client_secret'])): '');
set_config('buffer','client_id',$client_id);
set_config('buffer','client_secret',$client_secret);
info( t('Settings updated.'). EOL );
function buffer_addon_admin_post(&$a)
{
$client_id = ((x($_POST, 'client_id')) ? notags(trim($_POST['client_id'])) : '');
$client_secret = ((x($_POST, 'client_secret')) ? notags(trim($_POST['client_secret'])): '');
Config::set('buffer', 'client_id', $client_id);
Config::set('buffer', 'client_secret', $client_secret);
info(L10n::t('Settings updated.'). EOL);
}
function buffer_connect(&$a) {
if (isset($_REQUEST["error"])) {
$o = t('Error when registering buffer connection:')." ".$_REQUEST["error"];
$o = L10n::t('Error when registering buffer connection:')." ".$_REQUEST["error"];
return $o;
}
// Start a session. This is necessary to hold on to a few keys the callback script will also need
@ -90,9 +100,9 @@ function buffer_connect(&$a) {
$o .= '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>';
} else {
logger("buffer_connect: authenticated");
$o .= t("You are now authenticated to buffer. ");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
set_pconfig(local_user(), 'buffer','access_token', $buffer->access_token);
$o .= L10n::t("You are now authenticated to buffer. ");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
}
return($o);
@ -107,7 +117,7 @@ function buffer_jot_nets(&$a,&$b) {
$buffer_defpost = get_pconfig(local_user(),'buffer','post_by_default');
$selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> '
. t('Post to Buffer') . '</div>';
. L10n::t('Post to Buffer') . '</div>';
}
}
@ -132,11 +142,11 @@ function buffer_settings(&$a,&$s) {
/* Add some HTML to the existing form */
$s .= '<span id="settings_buffer_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_buffer_expanded\'); openClose(\'settings_buffer_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>';
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. L10n::t('Buffer Export').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_buffer_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_buffer_expanded\'); openClose(\'settings_buffer_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>';
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. L10n::t('Buffer Export').'</h3>';
$s .= '</span>';
$client_id = get_config("buffer", "client_id");
@ -146,21 +156,21 @@ function buffer_settings(&$a,&$s) {
$s .= '<div id="buffer-password-wrapper">';
if ($access_token == "") {
$s .= '<div id="buffer-authenticate-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/buffer/connect">'.t("Authenticate your Buffer connection").'</a>';
$s .= '<a href="'.$a->get_baseurl().'/buffer/connect">'.L10n::t("Authenticate your Buffer connection").'</a>';
$s .= '</div><div class="clear"></div>';
} else {
$s .= '<div id="buffer-enable-wrapper">';
$s .= '<label id="buffer-enable-label" for="buffer-checkbox">' . t('Enable Buffer Post Plugin') . '</label>';
$s .= '<label id="buffer-enable-label" for="buffer-checkbox">' . L10n::t('Enable Buffer Post Addon') . '</label>';
$s .= '<input id="buffer-checkbox" type="checkbox" name="buffer" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="buffer-bydefault-wrapper">';
$s .= '<label id="buffer-bydefault-label" for="buffer-bydefault">' . t('Post to Buffer by default') . '</label>';
$s .= '<label id="buffer-bydefault-label" for="buffer-bydefault">' . L10n::t('Post to Buffer by default') . '</label>';
$s .= '<input id="buffer-bydefault" type="checkbox" name="buffer_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="buffer-delete-wrapper">';
$s .= '<label id="buffer-delete-label" for="buffer-delete">' . t('Check to delete this preset') . '</label>';
$s .= '<label id="buffer-delete-label" for="buffer-delete">' . L10n::t('Check to delete this preset') . '</label>';
$s .= '<input id="buffer-delete" type="checkbox" name="buffer_delete" value="1" />';
$s .= '</div><div class="clear"></div>';
@ -169,7 +179,7 @@ function buffer_settings(&$a,&$s) {
$profiles = $buffer->go('/profiles');
if (is_array($profiles)) {
$s .= '<div id="buffer-accounts-wrapper">';
$s .= t("Posts are going to all accounts that are enabled by default:");
$s .= L10n::t("Posts are going to all accounts that are enabled by default:");
$s .= "<ul>";
foreach ($profiles as $profile) {
if (!$profile->default)
@ -189,7 +199,7 @@ function buffer_settings(&$a,&$s) {
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="buffer-submit" name="buffer-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="buffer-submit" name="buffer-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
}
@ -252,12 +262,9 @@ function buffer_send(&$a,&$b) {
$client_secret = get_config("buffer", "client_secret");
$access_token = get_pconfig($b['uid'], "buffer","access_token");
if($access_token) {
if ($access_token) {
$buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);
require_once("include/plaintext.php");
require_once("include/network.php");
$profiles = $buffer->go('/profiles');
if (is_array($profiles)) {
logger("Will send these parameter ".print_r($b, true), LOGGER_DEBUG);
@ -321,7 +328,7 @@ function buffer_send(&$a,&$b) {
$item["body"] = preg_replace("(\[s\](.*?)\[\/s\])ism",'-$1-',$item["body"]);
}
$post = plaintext($a, $item, $limit, $includedlinks, $htmlmode);
$post = BBCode::toPlaintext($item, $limit, $includedlinks, $htmlmode);
logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
// The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures
@ -334,11 +341,11 @@ function buffer_send(&$a,&$b) {
//if ($includedlinks) {
// if (isset($post["url"]))
// $post["url"] = short_link($post["url"]);
// $post["url"] = Network::shortenUrl($post["url"]);
// if (isset($post["image"]))
// $post["image"] = short_link($post["image"]);
// $post["image"] = Network::shortenUrl($post["image"]);
// if (isset($post["preview"]))
// $post["preview"] = short_link($post["preview"]);
// $post["preview"] = Network::shortenUrl($post["preview"]);
//}
// Seems like a bug to me
@ -347,8 +354,8 @@ function buffer_send(&$a,&$b) {
if (($profile->service == "twitter") && isset($post["url"]) && ($post["type"] != "photo"))
$post["text"] .= " ".$post["url"];
elseif (($profile->service == "appdotnet") && isset($post["url"]) && isset($post["title"]) && ($post["type"] != "photo")) {
$post["title"] = shortenmsg($post["title"], 90);
$post["text"] = shortenmsg($post["text"], $limit - (24 + strlen($post["title"])));
$post["title"] = Plaintext::shorten($post["title"], 90);
$post["text"] = Plaintext::shorten($post["text"], $limit - (24 + strlen($post["title"])));
$post["text"] .= "\n[".$post["title"]."](".$post["url"].")";
} elseif (($profile->service == "appdotnet") && isset($post["url"]) && ($post["type"] != "photo"))
$post["text"] .= " ".$post["url"];

View file

@ -58,7 +58,7 @@ msgid "Authenticate your Buffer connection"
msgstr ""
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgid "Enable Buffer Post Addon"
msgstr ""
#: buffer.php:151

View file

@ -60,8 +60,8 @@ msgid "Authenticate your Buffer connection"
msgstr "Přihlásit ke spojení na Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgstr "Povolit Buffer Post Plugin"
msgid "Enable Buffer Post Addon"
msgstr "Povolit Buffer Post Addon"
#: buffer.php:151
msgid "Post to Buffer by default"

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "návrat ke stránce konektor";
$a->strings["Post to Buffer"] = "Příspěvek na Buffer";
$a->strings["Buffer Export"] = "Buffer Export";
$a->strings["Authenticate your Buffer connection"] = "Přihlásit ke spojení na Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Povolit Buffer Post Plugin";
$a->strings["Enable Buffer Post Addon"] = "Povolit Buffer Post Addon";
$a->strings["Post to Buffer by default"] = "Defaultně zaslat na Buffer";
$a->strings["Check to delete this preset"] = "Zaškrtnout pro smazání tohoto nastavení";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "Příspěvky jsou zasílány na všechny účty, které jsou defaultně povoleny:";

View file

@ -60,8 +60,8 @@ msgid "Authenticate your Buffer connection"
msgstr "Authentifiziere deine Verbindung zu buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgstr "Buffer Post-Plugin aktivieren"
msgid "Enable Buffer Post Addon"
msgstr "Buffer Post-Addon aktivieren"
#: buffer.php:151
msgid "Post to Buffer by default"

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "zurück zur Connector Seite";
$a->strings["Post to Buffer"] = "Auf buffer veröffentlichen";
$a->strings["Buffer Export"] = "Buffer Export";
$a->strings["Authenticate your Buffer connection"] = "Authentifiziere deine Verbindung zu buffer";
$a->strings["Enable Buffer Post Plugin"] = "Buffer Post-Plugin aktivieren";
$a->strings["Enable Buffer Post Addon"] = "Buffer Post-Addon aktivieren";
$a->strings["Post to Buffer by default"] = "Standardmäßig auf buffer veröffentlichen";
$a->strings["Check to delete this preset"] = "Markieren um dieses Preset zu löschen";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "Beiträge werden an alle Accounts geschickt, die Standardmäßig aktiviert sind.";

View file

@ -59,8 +59,8 @@ msgid "Authenticate your Buffer connection"
msgstr "Autenticar su conexión de Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgstr "Active el plugin de publicación de Buffer"
msgid "Enable Buffer Post Addon"
msgstr "Active el addon de publicación de Buffer"
#: buffer.php:151
msgid "Post to Buffer by default"

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "Vuelva a la página de conexión"
$a->strings["Post to Buffer"] = "Publique en Buffer";
$a->strings["Buffer Export"] = "Exportar Buffer";
$a->strings["Authenticate your Buffer connection"] = "Autenticar su conexión de Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Active el plugin de publicación de Buffer";
$a->strings["Enable Buffer Post Addon"] = "Active el addon de publicación de Buffer";
$a->strings["Post to Buffer by default"] = "Publicar en Buffer por defecto";
$a->strings["Check to delete this preset"] = "Verificar para eliminar este preajuste";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "Las publicaciones van a todas las cuentas que estén habilitadas por defecto";

View file

@ -62,7 +62,7 @@ msgid "Authenticate your Buffer connection"
msgstr "Authentifier votre connexion à Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgid "Enable Buffer Post Addon"
msgstr "Activer le connecteur Buffer"
#: buffer.php:151

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "revenir à la page du connecteur"
$a->strings["Post to Buffer"] = "Publier sur Buffer";
$a->strings["Buffer Export"] = "Export Buffer";
$a->strings["Authenticate your Buffer connection"] = "Authentifier votre connexion à Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Activer le connecteur Buffer";
$a->strings["Enable Buffer Post Addon"] = "Activer le connecteur Buffer";
$a->strings["Post to Buffer by default"] = "Publier sur Buffer par défaut";
$a->strings["Check to delete this preset"] = "Cocher pour supprimer ce préréglage";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "Les posts sont envoyés à tous les comptes activés par défault:";

View file

@ -4,15 +4,15 @@
#
#
# Translators:
# fabrixxm <fabrix.xm@gmail.com>, 2014
# fabrixxm <fabrix.xm@gmail.com>, 2014,2018
# Sandro Santilli <strk@kbt.io>, 2015
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2015-11-01 11:05+0000\n"
"Last-Translator: Sandro Santilli <strk@kbt.io>\n"
"PO-Revision-Date: 2018-03-19 13:21+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -61,8 +61,8 @@ msgid "Authenticate your Buffer connection"
msgstr "Autentica la tua connessione a Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgstr "Abilita il plugin di invio a Buffer"
msgid "Enable Buffer Post Addon"
msgstr "Abilita il componente aggiuntivo di invio a Buffer"
#: buffer.php:151
msgid "Post to Buffer by default"

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "ritorna alla pagina del connettor
$a->strings["Post to Buffer"] = "Invia a Buffer";
$a->strings["Buffer Export"] = "Esporta Buffer";
$a->strings["Authenticate your Buffer connection"] = "Autentica la tua connessione a Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Abilita il plugin di invio a Buffer";
$a->strings["Enable Buffer Post Addon"] = "Abilita il componente aggiuntivo di invio a Buffer";
$a->strings["Post to Buffer by default"] = "Invia sempre a Buffer";
$a->strings["Check to delete this preset"] = "Seleziona per eliminare questo preset";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "I messaggi andranno a tutti gli account che sono abilitati:";

View file

@ -61,8 +61,8 @@ msgid "Authenticate your Buffer connection"
msgstr "Autenticar sua conexão de Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgstr "Habilita plugin para publicar no Buffer"
msgid "Enable Buffer Post Addon"
msgstr "Habilita addon para publicar no Buffer"
#: buffer.php:151
msgid "Post to Buffer by default"

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "Volte a página de conectores.";
$a->strings["Post to Buffer"] = "Publicar no Buffer";
$a->strings["Buffer Export"] = "Exportar Buffer";
$a->strings["Authenticate your Buffer connection"] = "Autenticar sua conexão de Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Habilita plugin para publicar no Buffer";
$a->strings["Enable Buffer Post Addon"] = "Habilita addon para publicar no Buffer";
$a->strings["Post to Buffer by default"] = "Publica no Buffer por padrão";
$a->strings["Check to delete this preset"] = "Marque para excluir este perfil";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "";

View file

@ -59,7 +59,7 @@ msgid "Authenticate your Buffer connection"
msgstr "Autentificați-vă conectarea la Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgid "Enable Buffer Post Addon"
msgstr "Activare Modul Postare pe Buffer"
#: buffer.php:151

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "revenire la pagina de conectare";
$a->strings["Post to Buffer"] = "Postați pe Buffer";
$a->strings["Buffer Export"] = "Export pe Buffer ";
$a->strings["Authenticate your Buffer connection"] = "Autentificați-vă conectarea la Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Activare Modul Postare pe Buffer";
$a->strings["Enable Buffer Post Addon"] = "Activare Modul Postare pe Buffer";
$a->strings["Post to Buffer by default"] = "Postați implicit pe Buffer";
$a->strings["Check to delete this preset"] = "Bifați pentru a șterge această presetare";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "Posturile merg către toate conturile care sunt activate implicit:";

View file

@ -60,7 +60,7 @@ msgid "Authenticate your Buffer connection"
msgstr "Аутентифицируйте свое соединение с Buffer"
#: buffer.php:146
msgid "Enable Buffer Post Plugin"
msgid "Enable Buffer Post Addon"
msgstr "Включить плагин Buffer"
#: buffer.php:151

View file

@ -15,7 +15,7 @@ $a->strings["return to the connector page"] = "вернуться на стра
$a->strings["Post to Buffer"] = "Написать в Buffer";
$a->strings["Buffer Export"] = "Экспорт в Buffer";
$a->strings["Authenticate your Buffer connection"] = "Аутентифицируйте свое соединение с Buffer";
$a->strings["Enable Buffer Post Plugin"] = "Включить плагин Buffer";
$a->strings["Enable Buffer Post Addon"] = "Включить плагин Buffer";
$a->strings["Post to Buffer by default"] = "Отправлять в Buffer по умолчанию";
$a->strings["Check to delete this preset"] = "Отметьте для удаления этих настроек";
$a->strings["Posts are going to all accounts that are enabled by default:"] = "Сообщения уходят во все учетные записи по умолчанию:";