diff --git a/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php b/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php index ec7e084e2f17c6eb9f816fd4dc2281cfbd7826fa..ab19ae961e4cc7955db65ab435bd5e28dfa90410 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.3.2 + * Version: 3.4 * Author: L1am0 * Author URI: http://www.simon-frey.eu * License: GPL2 @@ -116,16 +116,6 @@ class autopostToMastodon wp_enqueue_script('settings_page', $plugin_url . 'js/settings_page.js', array('jquery'), $infos['Version'], true); } - 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); - - $title_nonce = wp_create_nonce('mastodonNonce'); - wp_localize_script('toot_editor', 'ajax_obj', array( - 'ajax_url' => admin_url('admin-ajax.php'), - 'nonce' => $title_nonce, - )); - } } /** @@ -140,7 +130,7 @@ class autopostToMastodon add_options_page( 'Mastodon Autopost', 'Mastodon Autopost', - 'install_plugins', + 'manage_options', 'autopost-to-mastodon', array($this, 'show_configuration_page') ); @@ -496,28 +486,30 @@ class autopostToMastodon } //Replace excerpt - $post_content_long = $post->post_content; - if ($wp_version[0] == "5"){ + //Replace with the excerpt of the post + $post_optional_excerpt = $post->post_excerpt; + if (strlen($post_optional_excerpt) > 0) { + $post_content_long = $post_optional_excerpt; + } else { + $post_content_long = $post->post_content; + } + if ($wp_version[0] == "5") { $post_content_long = excerpt_remove_blocks($post_content_long); } - $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 = wp_strip_all_tags($post_content_long); //$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); + mb_internal_encoding("UTF-8"); + + $post_excerpt = mb_substr($post_content_long, 0, $excerpt_len); $message_template = str_replace("[excerpt]", $post_excerpt, $message_template); - return substr($message_template, 0, $toot_size); + return mb_substr($message_template, 0, $toot_size); } private function sendTestToot() diff --git a/wp-content/plugins/autopost-to-mastodon/readme.txt b/wp-content/plugins/autopost-to-mastodon/readme.txt index 4f8ea5b93ccf2c822dab8843492b9eb9c35af387..87c13046c5e80ac0c80d208e0d24f71d45d56a30 100644 --- a/wp-content/plugins/autopost-to-mastodon/readme.txt +++ b/wp-content/plugins/autopost-to-mastodon/readme.txt @@ -2,8 +2,8 @@ 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.3.2 +Tested up to: 5.2.1 +Stable tag: 3.4 License: GPLv2 Donate link: https://patreon.com/simonfrey License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -46,6 +46,16 @@ The plugin never transmits any data to me, or anyone else than the mastodon node == Changelog == += 3.4 = +* Fix for the manual added excerpt to also get encoded and remove html tags + += 3.3.4 = +* Remove toot editor javascript as we do not have a toot editor anymore + += 3.3.3 = +* Change permission for settings pages +* Update for HTML tags striping + = 3.3.2 = * Remove HTML tags from excerpt (with php strip_tags())