Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
noblogs-wp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
39
Issues
39
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ai
noblogs-wp
Commits
0c3756a3
Commit
0c3756a3
authored
Aug 05, 2019
by
agata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[auto] plugin: autopost-to-mastodon 3.4
parent
4fd40ea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
25 deletions
+27
-25
wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php
...ontent/plugins/autopost-to-mastodon/mastodon_autopost.php
+15
-23
wp-content/plugins/autopost-to-mastodon/readme.txt
wp-content/plugins/autopost-to-mastodon/readme.txt
+12
-2
No files found.
wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php
View file @
0c3756a3
...
...
@@ -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_plugi
ns'
,
'
manage_optio
ns'
,
'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
()
...
...
wp-content/plugins/autopost-to-mastodon/readme.txt
View file @
0c3756a3
...
...
@@ -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())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment