diff --git a/wp-content/plugins/autopost-to-mastodon/client.php b/wp-content/plugins/autopost-to-mastodon/client.php index ce1d044b9963873109ba0b0449430d4abff886a9..4b678321af7085a8dc689a9754513be43b774325 100644 --- a/wp-content/plugins/autopost-to-mastodon/client.php +++ b/wp-content/plugins/autopost-to-mastodon/client.php @@ -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){ diff --git a/wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.mo b/wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.mo new file mode 100644 index 0000000000000000000000000000000000000000..fd6e2071d3eefe03a30354dd698af31804821c13 Binary files /dev/null and b/wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.mo differ diff --git a/wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.po b/wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.po new file mode 100644 index 0000000000000000000000000000000000000000..b567b7440e801ca62ae3cd7b1b47a08860b7b5a7 --- /dev/null +++ b/wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.po @@ -0,0 +1,110 @@ +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" diff --git a/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php b/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php index cae5872a3688b3112acffbff221a0063902711d4..ec7e084e2f17c6eb9f816fd4dc2281cfbd7826fa 100644 --- a/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php +++ b/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php @@ -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); diff --git a/wp-content/plugins/autopost-to-mastodon/readme.txt b/wp-content/plugins/autopost-to-mastodon/readme.txt index 8abd514c723bc3ef67777fcbdb9faa661ca9b68e..4f8ea5b93ccf2c822dab8843492b9eb9c35af387 100644 --- a/wp-content/plugins/autopost-to-mastodon/readme.txt +++ b/wp-content/plugins/autopost-to-mastodon/readme.txt @@ -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