Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
big refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Aug 20, 2018
1 parent 523de43 commit 5cd21f5
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 280 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
};
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
60 changes: 60 additions & 0 deletions includes/class-ostatus-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* OStatus Admin Class
*/
class Ostatus_Admin {
/**
* Add admin menu entry
*/
public static function admin_menu() {
$options_page = add_options_page(
'OStatus',
'OStatus',
'manage_options',
'ostatus',
array( 'Ostatus_Admin', 'settings_page' )
);

add_action( 'load-' . $options_page, array( 'Ostatus_Admin', 'add_help_tab' ) );
}

/**
* Load settings page
*/
public static function settings_page() {
require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
wp_enqueue_style( 'plugin-install' );
wp_enqueue_script( 'plugin-install' );
add_thickbox();
$GLOBALS['tab'] = 'custom';

load_template( dirname( __FILE__ ) . '/../templates/settings-page.php' );
}

/**
* Register PubSubHubbub settings
*/
public static function register_settings() {
register_setting( 'ostatus', 'ostatus_feed_use_excerpt' );
}

public static function add_help_tab() {
get_current_screen()->add_help_tab(
array(
'id' => 'overview',
'title' => __( 'Overview', 'ostatus-for-wordpress' ),
'content' =>
'<p>' . __( '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' ) . '</p>' .
'<p>' . __( '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' ) . '</p>',
)
);

get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:', 'ostatus-for-wordpress' ) . '</strong></p>' .
'<p>' . __( '<a href="https://www.w3.org/community/ostatus/">W3C community page</a>', 'ostatus-for-wordpress' ) . '</p>' .
'<p>' . __( '<a href="https://www.w3.org/community/ostatus/wiki/Howto">How to OStatus-enable Your Application</a>', 'ostatus-for-wordpress' ) . '</p>' .
'<p>' . __( '<a href="https://github.com/pfefferle/wordpress-ostatus/issues">Give us feedback</a>', 'ostatus-for-wordpress' ) . '</p>' .
'<p>' . __( '<a href="https:/notiz.blog/donate">Donate</a>', 'ostatus-for-wordpress' ) . '</p>'
);
}
}
41 changes: 41 additions & 0 deletions includes/class-ostatus-discovery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* OStatus Discovery Class
*/
class Ostatus_Discovery {
/**
* 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}' ),
);

return $array;
}
}
66 changes: 66 additions & 0 deletions includes/class-ostatus-feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* OStatus Feed Class
*/
class Ostatus_Feed {
/**
* Adds OStatus Feed
*/
public static function add_ostatus_feed() {
add_feed( 'ostatus', array( 'Ostatus_Feed', 'do_feed_ostatus' ) );
}

/**
* 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;
}

/**
* 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;
}
}
105 changes: 67 additions & 38 deletions languages/ostatus-for-wordpress.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -14,27 +14,74 @@ msgstr ""
"Language-Team: LANGUAGE <LL@li.org>\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 "<a href=\"https://www.w3.org/community/ostatus/\">W3C community page</a>"
msgstr ""

#: includes/class-ostatus-admin.php:55
msgid ""
"<a href=\"https://www.w3.org/community/ostatus/wiki/Howto\">How to "
"OStatus-enable Your Application</a>"
msgstr ""

#: includes/class-ostatus-admin.php:56
msgid ""
"<a href=\"https://github.com/pfefferle/wordpress-ostatus/issues\">Give us "
"feedback</a>"
msgstr ""

#: includes/class-ostatus-admin.php:57
msgid "<a href=\"https:/notiz.blog/donate\">Donate</a>"
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 ""
Expand All @@ -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 <em>Best of OpenWeb Standards</em> 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, <a "
"OStatus is like a <em>Best of OpenWeb Standards</em> 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, <a "
"href=\"https://github.com/pfefferle/wordpress-ostatus/issues\" "
"target=\"_blank\">please let us know</a>.\n"
"\tThe installation is a bit painful, but we think it's much more <em>open "
"style</em> ;)"
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</a>. The installation is a bit "
"painful, but we think it's much more <em>open style</em> ;)"
msgstr ""

#. Plugin URI of the plugin/theme
Expand Down
Loading

0 comments on commit 5cd21f5

Please sign in to comment.