From 30a3de530ca9f8234dbf5077a54285d4f10e56e7 Mon Sep 17 00:00:00 2001
From: samba <samba@autistici.org>
Date: Sun, 19 May 2019 22:12:23 +0200
Subject: [PATCH] [auto] plugin: autopost-to-mastodon 3.3.2

---
 .../plugins/autopost-to-mastodon/client.php   |  21 +++-
 .../languages/autopost-to-mastodon-nl_NL.mo   | Bin 0 -> 2560 bytes
 .../languages/autopost-to-mastodon-nl_NL.po   | 110 ++++++++++++++++++
 .../mastodon_autopost.php                     |  16 ++-
 .../plugins/autopost-to-mastodon/readme.txt   |   9 +-
 5 files changed, 143 insertions(+), 13 deletions(-)
 create mode 100644 wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.mo
 create mode 100644 wp-content/plugins/autopost-to-mastodon/languages/autopost-to-mastodon-nl_NL.po

diff --git a/wp-content/plugins/autopost-to-mastodon/client.php b/wp-content/plugins/autopost-to-mastodon/client.php
index ce1d044b9..4b678321a 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
GIT binary patch
literal 2560
zcmca7#4?qEfq_Alfq_AWfq}t=k%7UKfq@~1iGe|kfq}t+nSnu;fq@~MnSnuwfq|iv
znSnu&fq|ienSnuxfq`KbGXsM#0|UceW(Ecx1_p+U%nS_T3=9nSm>C$@7#JA7F*7i5
zF)%Rvh01fVFfb@EFffR+Ffed1Fff?0Ffa%(FfiD&Ffhn7FfatLFfgz)FfbIbFfgbw
zFfdd=`SV#I<}GJ|*t3oW;-1|s3=Dh>3=HR37#Ktt7#QxdFfd3kFfe>#VPLReU|`^8
zWni!a`HPi-!HR)_p_!F|fs=uOVIM2R-V>}043Z2C3^$?TpIIUL|FS~dC&mU*FV6;X
zk0u)f12f2-Y!H8iutC(vvqAh_!3GJ-32Y1uq6`cS+o1e2Y>@E$#KyqD%fP_E$<Dwa
z$H2fK&JOXH89M_5Hv<EMEjz@2p6m<^1`G@gVeAn5+u0%EJ`t*KF*_uj4zV*ZC^IlH
zoMMNB!#j3}yZ^F7{Kv)t2^Vn=NIdCqK-}rT!N6e7z`zi}0STuG9FTZF$-%&2&%nU&
zp9A7QdrpXcFHQyqMFs|jcut5r8#y82*2~Gjz|X+IupBDBos)sVh=GCOFed{86Da;U
zA^!Wx39%oP)<77PCP3)}#0I53P}%~eKTzC((i_N3kQ^vYfx-zCmLNVTt$@-WC=IDF
zK->lrX90yNhylfn3=9m?P&O!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NC6G0vVWvG(ORA`PW
z$%Kai{w$Ts-~<UO2H(`26opcS#Kb&>q|7XZ(sH;jb>Z2`F()TAHBX@|KPMd&JN^Z!
zc}a<hMGP+a`9;MgrA4WE3V9%>GazN!RE7M4;vA48LqHh|lo&w4R+S10EC$!qyt4e#
zl+1Lr_zg=f%FinS1z1i>W;!?kbU-0e0!n<@iFx2CQz*|bN&&eiwWtal_KFNnsVRwh
z*(C~P`T0c(8L1`k44w*d94H7=QsEv0hi_tDNoJ}dg9|9M(^JdxQ;Skk6+(l2Kq(*{
z<lFRAkP{HPbRl^UqARlmq%JozD^DRcwWzoR9_*mxjj#xw|G@6T%z&lEh(bNT0Im;`
z3lXUg;;ocag_8W#?EKu~5=DrLoYcJZ5|sQ1O0{K(VDSYd(jtX?ScEyHW@lz)Lvm)Q
wLUw6h2`F&E@tT(c%8ez7>fpQy3PNaRQUK+|(#-7CJciUfhLY6m)VyK_0N@>|mjD0&

literal 0
HcmV?d00001

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 000000000..b567b7440
--- /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 cae5872a3..ec7e084e2 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 8abd514c7..4f8ea5b93 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
-- 
GitLab