Commit 30a3de53 authored by samba's avatar samba

[auto] plugin: autopost-to-mastodon 3.3.2

parent dc035e14
......@@ -15,7 +15,7 @@ class Client
$response = $this->_post('/api/v1/apps', array(
'client_name' => 'Mastodon Share for WordPress',
'redirect_uris' => $redirect_uri,
'scopes' => 'read write',
'scopes' => 'write:statuses write:media read:accounts',
'website' => $this->instance_url
));
......@@ -29,8 +29,8 @@ class Client
$params = http_build_query(array(
'response_type' => 'code',
'scope' => 'read write',
'redirect_uri' => $redirect_uri,
'scope' => 'write:statuses write:media read:accounts',
'client_id' =>$this->app->client_id
));
......@@ -126,21 +126,32 @@ class Client
);
$response = wp_remote_post( $this->getValidURL($url), $args );
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
} else {
$responseBody = wp_remote_retrieve_body($response);
return json_decode($responseBody);
}
return $response;
}
public function get($url, $data = array(), $headers = array()) {
$args = array(
'headers' => $headers,
'redirection' => 5
);
$response = wp_remote_get( $this->getValidURL($url), $args );
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
} else {
$responseBody = wp_remote_retrieve_body($response);
return json_decode($responseBody);
}
return json_decode($responseBody);
return $response;
}
public function dump($value){
......
msgid "Mastodon Autopost Configuration"
msgstr "Mastodon Autopost Configuratie"
msgid "Simple configuration"
msgstr "Eenvoudige configuratie"
msgid "Advanced configuration"
msgstr "Uitgebreide configuratie"
msgid "Instance"
msgstr "Instantie"
msgid "Connected as"
msgstr "Verbonden als"
msgid "Connect to Mastodon"
msgstr "Met Mastodon verbinden"
msgid "Disconnect"
msgstr "Loskoppelen"
msgid "Send test toot"
msgstr "Test Toot verzenden"
msgid "Disconnected"
msgstr "Losgekoppeld"
msgid "Default Content Warning"
msgstr "Standaard Content Waarschuwing"
msgid "and"
msgstr "en"
msgid "You can use these metas in the message"
msgstr "U kunt de volgende meta's in het bericht gebruiken"
msgid "Save configuration"
msgstr "Configuratie opslaan"
msgid "Autopost new posts"
msgstr "Nieuwe berichten automatisch plaatsen"
msgid "Authentification, please wait"
msgstr "Even geduld alstublieft"
msgid "Toot mode"
msgstr "Toot modus"
msgid "Message"
msgstr "Bericht"
msgid "Toot size"
msgstr "Toot lengte"
msgid "Can't log you in."
msgstr "Inloggen werkte niet."
msgid "Please login to your mastodon account!"
msgstr "Meld u aan bij uw Mastodon-account!"
msgid "Go to Mastodon Autopost Settings"
msgstr "Naar de instellingen van Mastopost Autopost gaan"
msgid "Instance message"
msgstr "Instantie bericht"
msgid "The given instance url belongs to no valid mastodon instance !"
msgstr "De ingevoerde URL is geen geldige Mastodon-instantie!"
msgid "Thank you to set your Mastodon instance before connect !"
msgstr "Bedankt voor het configureren van de Mastodon instantie!"
msgid "Redirect to "
msgstr "Doorsturen naar "
msgid "Configuration successfully saved !"
msgstr "Configuratie is succesvol opgeslagen!"
msgid "Toot saved for schedule !"
msgstr "Toot opgeslagen voor de toekomst!"
msgid "This is my first post with Mastodon Autopost for Wordpress"
msgstr "Dit is mijn eerste bericht met Mastodon Autopost voor Wordpress"
msgid "Sorry, can't send toot !"
msgstr "Verontschuldigingen, de toot kan niet worden verzonden!"
msgid "Toot successfully sent !"
msgstr "Toot succesvol verzonden!"
msgid "Toot on Mastodon"
msgstr "Autopost op Mastodon"
msgid "Public"
msgstr "Openbaar"
msgid "Unlisted"
msgstr "Minder openbaar"
msgid "Private"
msgstr "Alleen volgers"
msgid "Direct"
msgstr "Direct"
msgid "characters"
msgstr "tekens"
msgid "View Toot"
msgstr "Bekijk Toot"
......@@ -3,7 +3,7 @@
* Plugin Name: Mastodon Autopost
* Plugin URI: https://github.com/simonfrey/mastodon_wordpress_autopost
* Description: A Wordpress Plugin that automatically posts your new articles to Mastodon
* Version: 3.2.7.5
* Version: 3.3.2
* Author: L1am0
* Author URI: http://www.simon-frey.eu
* License: GPL2
......@@ -116,7 +116,7 @@ class autopostToMastodon
wp_enqueue_script('settings_page', $plugin_url . 'js/settings_page.js', array('jquery'), $infos['Version'], true);
}
if (in_array($pagenow, array('post-new.php', 'post.php'))) {
if (in_array($pagenow, ['post-new.php', 'post.php'])) {
$plugin_url = plugin_dir_url(__FILE__);
wp_enqueue_script('toot_editor', $plugin_url . 'js/toot_editor.js', array('jquery'), $infos['Version'], true);
......@@ -338,13 +338,13 @@ class autopostToMastodon
update_post_meta($id, 'autopostToMastodon-post-status', 'off');
add_action('admin_notices', 'autopostToMastodon_notice_toot_success');
if (isset($toot->error)) {
if (isset($toot->errors)) {
update_option(
'autopostToMastodon-notice',
serialize(
array(
'message' => '<strong>Mastodon Autopost</strong> : ' . __('Sorry, can\'t send toot !', 'autopost-to-mastodon') .
'<p><strong>' . __('Instance message', 'autopost-to-mastodon') . '</strong> : ' . $toot->error . '</p>',
'<p><strong>' . __('Instance message', 'autopost-to-mastodon') . '</strong> : ' . json_encode($toot->errors) . '</p>',
'class' => 'error',
)
)
......@@ -427,7 +427,7 @@ class autopostToMastodon
'autopostToMastodon_metabox',
'Mastodon Autopost',
array($this, 'metabox'),
array('post', 'page'),
['post', 'page'],
'side',
'high'
);
......@@ -502,11 +502,17 @@ class autopostToMastodon
}
$post_content_long = wp_strip_all_tags($post_content_long);
$post_content_long = strip_shortcodes($post_content_long);
$post_content_long = strip_tags($post_content_long);
$post_content_long = html_entity_decode($post_content_long, ENT_COMPAT, 'UTF-8');
//$post_content_long = str_replace("...", "",$post_content_long);
$excerpt_len = $toot_size - strlen($message_template) + 9 - 5;
//Replace with the excerpt of the post
$post_optional_excerpt = get_the_excerpt($id);
if (strlen($post_optional_excerpt)>0){
$post_content_long = $post_optional_excerpt;
}
$post_excerpt = substr($post_content_long, 0, $excerpt_len);
$message_template = str_replace("[excerpt]", $post_excerpt, $message_template);
......
......@@ -3,7 +3,7 @@ Contributors: l1am0, Hellexis
Tags: mastodon, Mastodon, Mastdon Autopost, federated web, GNU social, statusnet, social web, social media, auto post
Requires at least: 4.6
Tested up to: 5.0
Stable tag: 3.2.7.5
Stable tag: 3.3.2
License: GPLv2
Donate link: https://patreon.com/simonfrey
License URI: http://www.gnu.org/licenses/gpl-2.0.html
......@@ -46,8 +46,11 @@ The plugin never transmits any data to me, or anyone else than the mastodon node
== Changelog ==
= 3.2.7.5 =
* Revert changes
= 3.3.2 =
* Remove HTML tags from excerpt (with php strip_tags())
= 3.3 =
* Dutch translation (Thanks to [Alex Belgraver](https://fediversum.nl))
= 3.2.7 =
* Auth workflow change
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment