Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
noblogs-wp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai
noblogs-wp
Commits
0c3756a3
Commit
0c3756a3
authored
5 years ago
by
agata
Browse files
Options
Downloads
Patches
Plain Diff
[auto] plugin: autopost-to-mastodon 3.4
parent
4fd40ea3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php
+15
-23
15 additions, 23 deletions
...ontent/plugins/autopost-to-mastodon/mastodon_autopost.php
wp-content/plugins/autopost-to-mastodon/readme.txt
+12
-2
12 additions, 2 deletions
wp-content/plugins/autopost-to-mastodon/readme.txt
with
27 additions
and
25 deletions
wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php
+
15
−
23
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
()
...
...
This diff is collapsed.
Click to expand it.
wp-content/plugins/autopost-to-mastodon/readme.txt
+
12
−
2
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())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment