diff --git a/Gruntfile.js b/Gruntfile.js
index 246a227..390c9c8 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -26,5 +26,5 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-wp-i18n');
// Default task(s).
- grunt.registerTask('default', ['wp_readme_to_markdown']);
+ grunt.registerTask('default', ['wp_readme_to_markdown', 'makepot']);
};
diff --git a/README.md b/README.md
index 73ac540..5040dfa 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,8 @@
**Tags:** ostatus, federated, mastodon, social, gnusocial, statusnet
**Donate link:** https://notiz.blog/donate/
**Requires at least:** 4.5
-**Tested up to:** 4.9.6
-**Stable tag:** 2.3.2
+**Tested up to:** 4.9.8
+**Stable tag:** 2.4.0
**License:** MIT
**License URI:** https://opensource.org/licenses/MIT
@@ -63,6 +63,11 @@ If you are the author of a relevant plugin, or are planning one, contact us to g
## Changelog ##
+### 2.4.0 ###
+
+* complete refactoring
+* better text encoding
+
### 2.3.2 ###
* updated WebSub support
diff --git a/includes/class-ostatus-admin.php b/includes/class-ostatus-admin.php
new file mode 100644
index 0000000..9932f29
--- /dev/null
+++ b/includes/class-ostatus-admin.php
@@ -0,0 +1,60 @@
+add_help_tab(
+ array(
+ 'id' => 'overview',
+ 'title' => __( 'Overview', 'ostatus-for-wordpress' ),
+ 'content' =>
+ '
' . __( 'OStatus lets people on different social networks follow each other. It applies a group of related protocols (PubSubHubbub, ActivityStreams, Salmon, Portable Contacts, and Webfinger) to this problem in what we believe is a simple and obvious way.', 'ostatus-for-wordpress' ) . '
' .
+ '
' . __( 'OStatus is a minimal specification for distributed status updates or microblogging. Many social applications can be modelled with status updates, however. Practically any software that generates RSS or Atom feeds could be OStatus-enabled. Travel networks, event invitation systems, wikis, photo-sharing systems, social news sites, social music sites, podcasting servers, blogs, version control systems, and general purpose social networks would all be candidates for OStatus use.', 'ostatus-for-wordpress' ) . '
'
+ );
+ }
+}
diff --git a/includes/class-ostatus-discovery.php b/includes/class-ostatus-discovery.php
new file mode 100644
index 0000000..8fd8adb
--- /dev/null
+++ b/includes/class-ostatus-discovery.php
@@ -0,0 +1,41 @@
+ 'http://schemas.google.com/g/2010#updates-from',
+ 'href' => get_author_feed_link( $user->ID, 'ostatus' ),
+ 'type' => 'application/atom+xml',
+ );
+
+ $array['links'][] = array(
+ 'rel' => 'http://ostatus.org/schema/1.0/subscribe',
+ 'template' => site_url( '/?profile={uri}' ),
+ );
+
+ return $array;
+ }
+
+ /**
+ * Adds the the atom links to the host-meta-xrd-file
+ */
+ public static function host_meta( $array ) {
+ $array['links'][] = array(
+ 'rel' => 'http://schemas.google.com/g/2010#updates-from',
+ 'href' => get_feed_link( 'ostatus' ),
+ 'type' => 'application/atom+xml',
+ );
+
+ $array['links'][] = array(
+ 'rel' => 'http://ostatus.org/schema/1.0/subscribe',
+ 'template' => site_url( '/?profile={uri}' ),
+ );
+
+ return $array;
+ }
+}
diff --git a/includes/class-ostatus-feed.php b/includes/class-ostatus-feed.php
new file mode 100644
index 0000000..21a22b1
--- /dev/null
+++ b/includes/class-ostatus-feed.php
@@ -0,0 +1,66 @@
+post_author, 'ostatus' );
+
+ $feeds[] = get_feed_link( 'ostatus' );
+
+ return $feeds;
+ }
+
+ /**
+ * Enable discovery
+ *
+ * @return boolean;
+ */
+ public static function pubsubhubbub_show_discovery( $show_discovery ) {
+ global $withcomments;
+
+ if ( ! $withcomments ) {
+ $withcomments = 0;
+ }
+
+ if ( is_feed( 'ostatus' ) && ( ( ! is_archive() && ! is_singular() && 0 == $withcomments ) || is_author() ) ) {
+ $show_discovery = true;
+ }
+
+ return $show_discovery;
+ }
+
+ /**
+ * Register new atom feed
+ */
+ public static function do_feed_ostatus( $for_comments ) {
+ if ( $for_comments ) {
+ load_template( dirname( __FILE__ ) . '/../templates/feed-ostatus-comments.php' );
+ } else {
+ load_template( dirname( __FILE__ ) . '/../templates/feed-ostatus.php' );
+ }
+ }
+
+ public static function the_feed_content( $output ) {
+ if ( is_feed( 'ostatus' ) ) {
+ return htmlspecialchars( html_entity_decode( $output ), ENT_COMPAT | ENT_HTML401, "UTF-8", false );
+ }
+
+ return $output;
+ }
+}
diff --git a/languages/ostatus-for-wordpress.pot b/languages/ostatus-for-wordpress.pot
index 407a9ea..e88ed03 100644
--- a/languages/ostatus-for-wordpress.pot
+++ b/languages/ostatus-for-wordpress.pot
@@ -2,10 +2,10 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
-"Project-Id-Version: OStatus 2.3.2\n"
+"Project-Id-Version: OStatus 2.4.0\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/ostatus-for-wordpress\n"
-"POT-Creation-Date: 2018-07-02 14:46:03+00:00\n"
+"POT-Creation-Date: 2018-08-20 21:14:50+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -14,27 +14,74 @@ msgstr ""
"Language-Team: LANGUAGE \n"
"X-Generator: grunt-wp-i18n 0.5.4\n"
-#: templates/feed-ostatus-comments.php:37
+#: includes/class-ostatus-admin.php:45
+msgid "Overview"
+msgstr ""
+
+#: includes/class-ostatus-admin.php:47
+msgid ""
+"OStatus lets people on different social networks follow each other. It "
+"applies a group of related protocols (PubSubHubbub, ActivityStreams, "
+"Salmon, Portable Contacts, and Webfinger) to this problem in what we "
+"believe is a simple and obvious way."
+msgstr ""
+
+#: includes/class-ostatus-admin.php:48
+msgid ""
+"OStatus is a minimal specification for distributed status updates or "
+"microblogging. Many social applications can be modelled with status "
+"updates, however. Practically any software that generates RSS or Atom feeds "
+"could be OStatus-enabled. Travel networks, event invitation systems, wikis, "
+"photo-sharing systems, social news sites, social music sites, podcasting "
+"servers, blogs, version control systems, and general purpose social "
+"networks would all be candidates for OStatus use."
+msgstr ""
+
+#: includes/class-ostatus-admin.php:53
+msgid "For more information:"
+msgstr ""
+
+#: includes/class-ostatus-admin.php:54
+msgid "W3C community page"
+msgstr ""
+
+#: includes/class-ostatus-admin.php:55
+msgid ""
+"How to "
+"OStatus-enable Your Application"
+msgstr ""
+
+#: includes/class-ostatus-admin.php:56
+msgid ""
+"Give us "
+"feedback"
+msgstr ""
+
+#: includes/class-ostatus-admin.php:57
+msgid "Donate"
+msgstr ""
+
+#: templates/feed-ostatus-comments.php:36
#. translators: Comments feed title. 1: Post title
msgid "Comments on %s"
msgstr ""
-#: templates/feed-ostatus-comments.php:40
+#: templates/feed-ostatus-comments.php:39
#. translators: Comments feed title. 1: Site name, 2: Search query
msgid "Comments for %1$s searching on %2$s"
msgstr ""
-#: templates/feed-ostatus-comments.php:43
+#: templates/feed-ostatus-comments.php:42
#. translators: Comments feed title. 1: Site name
msgid "Comments for %s"
msgstr ""
-#: templates/feed-ostatus-comments.php:91
+#: templates/feed-ostatus-comments.php:90
#. translators: Individual comment title. 1: Post title, 2: Comment author name
msgid "Comment on %1$s by %2$s"
msgstr ""
-#: templates/feed-ostatus-comments.php:94
+#: templates/feed-ostatus-comments.php:93
#. translators: Comment author title. 1: Comment author name
msgid "By: %s"
msgstr ""
@@ -43,51 +90,33 @@ msgstr ""
msgid "OStatus"
msgstr ""
-#: templates/settings-page.php:12
+#: templates/settings-page.php:4
msgid ""
-"OStatus for WordPress turns your blog into a federated social network.\n"
-"\tThis means you can share and talk to everyone using the OStatus protocol,\n"
-"\tincluding users of Status.net, Identi.ca and Mastodon"
+"OStatus for WordPress turns your blog into a federated social network. This "
+"means you can share and talk to everyone using the OStatus protocol, "
+"including users of Status.net, Identi.ca and Mastodon."
msgstr ""
-#: templates/settings-page.php:16
+#: templates/settings-page.php:6
msgid "Settings"
msgstr ""
-#: templates/settings-page.php:28
+#: templates/settings-page.php:18
msgid "Show feed summary"
msgstr ""
-#: templates/settings-page.php:36
+#: templates/settings-page.php:25
msgid "Dependencies"
msgstr ""
-#: templates/settings-page.php:38
+#: templates/settings-page.php:27
msgid ""
-"OStatus is like a Best of OpenWeb Standards and so is this plugin.\n"
-"\tIf there is a plugin available that already implements one of these "
-"standards, we will use/support it.\n"
-"\tIf we are missing one, Best of OpenWeb Standards and so is this plugin. "
+"If there is a plugin available that already implements one of these "
+"standards, we will use/support it. If we are missing one, please let us know.\n"
-"\tThe installation is a bit painful, but we think it's much more open "
-"style ;)"
-msgstr ""
-
-#: templates/settings-page.php:70
-msgid "Further readings"
-msgstr ""
-
-#: templates/settings-page.php:72
-msgid "w3.org community page"
-msgstr ""
-
-#: templates/settings-page.php:73
-msgid "How to OStatus-enable Your Application"
-msgstr ""
-
-#: templates/settings-page.php:74
-msgid "Give us feedback"
+"target=\"_blank\">please let us know. The installation is a bit "
+"painful, but we think it's much more open style ;)"
msgstr ""
#. Plugin URI of the plugin/theme
diff --git a/ostatus-for-wordpress.php b/ostatus-for-wordpress.php
index a49fb7c..c7ee699 100644
--- a/ostatus-for-wordpress.php
+++ b/ostatus-for-wordpress.php
@@ -7,7 +7,7 @@
* Author URI: https://notiz.blog/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
- * Version: 2.3.2
+ * Version: 2.4.0
* Text Domain: ostatus-for-wordpress
* Domain Path: /languages
*/
@@ -15,177 +15,32 @@
// support the legacy WebFinger specs
define( 'WEBFINGER_LEGACY', true );
-add_action( 'init', array( 'Ostatus', 'init' ) );
-
/**
- * Ostatus class
- *
- * @author Matthias Pfefferle
- * @see https://www.w3.org/community/ostatus/
+ * Initialize the plugin, registering WordPress hooks.
*/
-class Ostatus {
-
- /**
- * Initialize the plugin, registering WordPress hooks.
- */
- public static function init() {
- require_once dirname( __FILE__ ) . '/includes/functions.php';
-
- add_filter( 'webfinger_user_data', array( 'Ostatus', 'webfinger' ), 10, 3 );
- add_filter( 'host_meta', array( 'Ostatus', 'host_meta' ) );
-
- add_feed( 'ostatus', array( 'Ostatus', 'do_feed_ostatus' ) );
- add_action( 'do_feed_ostatus', array( 'Ostatus', 'do_feed_ostatus' ), 10, 1 );
-
- add_filter( 'pubsubhubbub_feed_urls', array( 'Ostatus', 'pubsubhubbub_feed_urls' ), 10, 2 );
- add_filter( 'pubsubhubbub_show_discovery', array( 'Ostatus', 'pubsubhubbub_show_discovery' ), 12 );
-
- add_action( 'admin_init', array( 'Ostatus', 'text_domain' ) );
- add_action( 'admin_menu', array( 'Ostatus', 'admin_menu' ) );
- add_action( 'admin_init', array( 'Ostatus', 'register_settings' ) );
-
- add_filter( 'the_excerpt_rss', array( 'Ostatus', 'the_feed_content' ), 99 );
- add_filter( 'the_title_rss', array( 'Ostatus', 'the_feed_content' ), 99 );
- add_filter( 'the_content_feed', array( 'Ostatus', 'the_feed_content' ), 99 );
- add_filter( 'comment_text', array( 'Ostatus', 'the_feed_content' ), 99 );
- }
-
- /**
- * adds the the atom links to the webfinger-xrd-file
- */
- public static function webfinger( $array, $resource, $user ) {
- $array['links'][] = array(
- 'rel' => 'http://schemas.google.com/g/2010#updates-from',
- 'href' => get_author_feed_link( $user->ID, 'ostatus' ),
- 'type' => 'application/atom+xml',
- );
-
- $array['links'][] = array(
- 'rel' => 'http://ostatus.org/schema/1.0/subscribe',
- 'template' => site_url( '/?profile={uri}' ),
- );
-
- return $array;
- }
-
- /**
- * Adds the the atom links to the host-meta-xrd-file
- */
- public static function host_meta( $array ) {
- $array['links'][] = array(
- 'rel' => 'http://schemas.google.com/g/2010#updates-from',
- 'href' => get_feed_link( 'ostatus' ),
- 'type' => 'application/atom+xml',
- );
-
- $array['links'][] = array(
- 'rel' => 'http://ostatus.org/schema/1.0/subscribe',
- 'template' => site_url( '/?profile={uri}' ),
- );
-
- // add lrdd links if legacy plugin does not exists
- if ( class_exists( 'WebFingerPlugin' ) && ! class_exists( 'WebFingerLegacy_Plugin' ) ) {
- $array['links'][] = array(
- 'rel' => 'lrdd',
- 'template' => site_url( '/.well-known/webfinger?resource={uri}' ),
- 'type' => 'application/jrd+json',
- );
-
- $array['links'][] = array(
- 'rel' => 'lrdd',
- 'template' => site_url( '/.well-known/webfinger?resource={uri}' ),
- 'type' => 'application/json',
- );
- }
-
- return $array;
- }
-
- /**
- * Ping hubs
- *
- * @param int $post_id
- *
- * @return int;
- */
- public static function pubsubhubbub_feed_urls( $feeds, $post_id ) {
- $post = get_post( $post_id );
- $feeds[] = get_author_feed_link( $post->post_author, 'ostatus' );
-
- $feeds[] = get_feed_link( 'ostatus' );
-
- return $feeds;
- }
-
- /**
- * Enable discovery
- *
- * @return boolean;
- */
- public static function pubsubhubbub_show_discovery( $show_discovery ) {
- global $withcomments;
-
- if ( ! $withcomments ) {
- $withcomments = 0;
- }
-
- if ( is_feed( 'ostatus' ) && ( ( ! is_archive() && ! is_singular() && 0 == $withcomments ) || is_author() ) ) {
- $show_discovery = true;
- }
-
- return $show_discovery;
- }
-
- /**
- * Load plugin text domain
- */
- public static function text_domain() {
- load_plugin_textdomain( 'ostatus-for-wordpress' );
- }
+function init() {
+ require_once dirname( __FILE__ ) . '/includes/functions.php';
- /**
- * Add admin menu entry
- */
- public static function admin_menu() {
- add_options_page(
- 'OStatus',
- 'OStatus',
- 'manage_options',
- 'ostatus',
- array( 'Ostatus', 'settings_page' )
- );
- }
+ load_plugin_textdomain( 'ostatus-for-wordpress' );
- /**
- * Load settings page
- */
- public static function settings_page() {
- load_template( dirname( __FILE__ ) . '/templates/settings-page.php' );
- }
+ require_once dirname( __FILE__ ) . '/includes/class-ostatus-admin.php';
+ add_action( 'admin_menu', array( 'Ostatus_Admin', 'admin_menu' ) );
+ add_action( 'admin_init', array( 'Ostatus_Admin', 'register_settings' ) );
- /**
- * Register new atom feed
- */
- public static function do_feed_ostatus( $for_comments ) {
- if ( $for_comments ) {
- load_template( dirname( __FILE__ ) . '/templates/feed-ostatus-comments.php' );
- } else {
- load_template( dirname( __FILE__ ) . '/templates/feed-ostatus.php' );
- }
- }
+ require_once dirname( __FILE__ ) . '/includes/class-ostatus-discovery.php';
+ add_filter( 'webfinger_user_data', array( 'Ostatus_Discovery', 'webfinger' ), 10, 3 );
+ add_filter( 'host_meta', array( 'Ostatus_Discovery', 'host_meta' ) );
- public static function the_feed_content( $output ) {
- if ( is_feed( 'ostatus' ) ) {
- return htmlspecialchars( $output );
- }
+ require_once dirname( __FILE__ ) . '/includes/class-ostatus-feed.php';
+ add_action( 'init', array( 'Ostatus_Feed', 'add_ostatus_feed' ) );
+ add_action( 'do_feed_ostatus', array( 'Ostatus_Feed', 'do_feed_ostatus' ), 10, 1 );
- return $output;
- }
+ add_filter( 'pubsubhubbub_feed_urls', array( 'Ostatus_Feed', 'pubsubhubbub_feed_urls' ), 10, 2 );
+ add_filter( 'pubsubhubbub_show_discovery', array( 'Ostatus_Feed', 'pubsubhubbub_show_discovery' ), 12 );
- /**
- * Register PubSubHubbub settings
- */
- public static function register_settings() {
- register_setting( 'ostatus', 'ostatus_feed_use_excerpt' );
- }
+ add_filter( 'the_excerpt_rss', array( 'Ostatus_Feed', 'the_feed_content' ), 99 );
+ add_filter( 'the_title_rss', array( 'Ostatus_Feed', 'the_feed_content' ), 99 );
+ add_filter( 'the_content_feed', array( 'Ostatus_Feed', 'the_feed_content' ), 99 );
+ add_filter( 'comment_text', array( 'Ostatus_Feed', 'the_feed_content' ), 99 );
}
+add_action( 'plugins_loaded', 'init' );
diff --git a/readme.txt b/readme.txt
index 19f98f6..7b041f5 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,8 +3,8 @@ Contributors: pepijndevos, pfefferle
Tags: ostatus, federated, mastodon, social, gnusocial, statusnet
Donate link: https://notiz.blog/donate/
Requires at least: 4.5
-Tested up to: 4.9.6
-Stable tag: 2.3.2
+Tested up to: 4.9.8
+Stable tag: 2.4.0
License: MIT
License URI: https://opensource.org/licenses/MIT
@@ -63,6 +63,11 @@ If you are the author of a relevant plugin, or are planning one, contact us to g
== Changelog ==
+= 2.4.0 =
+
+* complete refactoring
+* better text encoding
+
= 2.3.2 =
* updated WebSub support
diff --git a/templates/feed-ostatus-comments.php b/templates/feed-ostatus-comments.php
index 8d9bc79..347ebb6 100644
--- a/templates/feed-ostatus-comments.php
+++ b/templates/feed-ostatus-comments.php
@@ -28,8 +28,7 @@
* @since 2.8.0
*/
do_action( 'atom_comments_ns' );
- ?>
->
+ ?>>
-
-
+ ?>
+
+
' . get_comment_author_url() . '';}
-?>
-
+ echo '' . get_comment_author_url() . '';
+ }
+ ?>
diff --git a/templates/settings-page.php b/templates/settings-page.php
index 85dbbd5..7c4784b 100644
--- a/templates/settings-page.php
+++ b/templates/settings-page.php
@@ -1,76 +1,55 @@
-
-
+
-
+
-
+
-
+
-
Best of OpenWeb Standards and so is this plugin.
- If there is a plugin available that already implements one of these standards, we will use/support it.
- If we are missing one, please let us know.
- The installation is a bit painful, but we think it\'s much more open style ;)', 'ostatus-for-wordpress' ); ?>
+
Best of OpenWeb Standards and so is this plugin. If there is a plugin available that already implements one of these standards, we will use/support it. If we are missing one, please let us know. The installation is a bit painful, but we think it\'s much more open style ;)', 'ostatus-for-wordpress' ); ?>