This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
319 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.