Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjamieson2 committed Jun 18, 2019
1 parent 494aa52 commit afb6465
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 83 deletions.
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 24 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Yarns Microsub Server #
**Contributors:** jackjamieson2, dshanske
**Tags:** microsub, indieweb, feed, reader
**Requires at least:** 4.7
**Tested up to:** 4.9.6
**Requires at least:** 4.6
**Tested up to:** 5.2.1
**Stable tag:** trunk
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT
Expand All @@ -25,7 +25,7 @@ Accompanied by other plugins that support [IndieWeb](https://indieweb.org) stand
## Installation
Since Yarns is still in development, it is not yet available on the WordPress plugin repository. This means you'll have to install it from GitHub directly.

You can do this by downloading the [latest release](https://github.com/jackjamieson2/yarns-microsub-server/releases) as a .zip.
You can do this by downloading the [latest release](https://github.com/jackjamieson2/yarns-microsub-server/releases) as a .zip.

Then install in WordPress by going to Plugins->Add New->Upload Plugin, and selecting the .zip you just downloaded.

Expand All @@ -43,11 +43,30 @@ The easiest way to get started is to install the [IndieWeb plugin](https://wordp
## Using Yarns
Yarns is a Microsub server. This means it lets you subscribe to many kinds of websites, including most blogs and news sites. There are two parts to using Yarns

### Viewing your feeds
To view your feeds, you must use a [Microsub Client](https://indieweb.org/Microsub#Clients).



### Subscribing to feeds
You can subscribe to feeds using Yarns' settings page in the WordPress dashboard, or using a Microsub client that supports modifying your feeds (e.g. [Together](http://alltogethernow.io)).

### Viewing your feeds
To view your feeds, you must use a [Microsub Client](https://indieweb.org/Microsub#Clients).
#### Adding feeds using Yarns' UI in the WordPress dashboard
##### Accessing Yarns' Settings:
- (Recommended) If you have the [IndieWeb plugin](https://wordpress.org/plugins/indieweb/) installed, then go to your WordPress dashboard, and choose 'Yarns Microsub Server' from the IndieWeb menu.
- Otherwise, [@@@ Review where this menu option is]

##### Adding channels
First, you need to add at least one channel to organize your feeds. For example, you could create separate channels for 'News', 'Sports', 'Family' etc.

##### Subscribing to feeds
Once you've created a channel, click on it to add some feeds.

Type the URL for a site you want to follow in the 'add feeds' box, then click search. Yarns' will try to find feeds on that site, and will then list them.

Once Yarns' displays a list of feeds, you can




## Acknowledgements
Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,30 @@
"source": {
"type": "git",
"url": "https://github.com/dshanske/parse-this.git",
"reference": "5e7d6af2eaf07f10e494a64a9cfc95df754d1621"
"reference": "e4a4af206fbbe5526e144f4649f7932ac4203b5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dshanske/parse-this/zipball/5e7d6af2eaf07f10e494a64a9cfc95df754d1621",
"reference": "5e7d6af2eaf07f10e494a64a9cfc95df754d1621",
"url": "https://api.github.com/repos/dshanske/parse-this/zipball/e4a4af206fbbe5526e144f4649f7932ac4203b5e",
"reference": "e4a4af206fbbe5526e144f4649f7932ac4203b5e",
"shasum": ""
},
"require": {
"composer/installers": "~1.0",
"mf2/mf2": "dev-master",
"php": ">=5.3.0"
"php": ">=5.4.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
"masterminds/html5": "^2.6",
"mf2/mf2": "dev-master",
"phpcompatibility/php-compatibility": "*",
"phpcompatibility/phpcompatibility-wp": "^1.0",
"simplepie/simplepie": "*",
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "*",
"wpreadme2markdown/wp2md": "^3.0"
},
"time": "2019-06-14T05:30:37+00:00",
"time": "2019-06-15T05:40:35+00:00",
"type": "wordpress-plugin",
"extra": {
"installer-name": "parse-this"
Expand Down
4 changes: 2 additions & 2 deletions vendor/parse-this/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"installer-name": "parse-this"
},
"require": {
"php": ">=5.3.0",
"mf2/mf2": "dev-master",
"php": ">=5.4.0",
"composer/installers": "~1.0"
},
"require-dev": {
"mf2/mf2": "dev-master",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
"squizlabs/php_codesniffer": "*",
"phpcompatibility/php-compatibility": "*",
Expand Down
18 changes: 18 additions & 0 deletions vendor/parse-this/includes/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

// autoloader for Parse This
spl_autoload_register(
function ( $class ) {
$base_dir = trailingslashit( __DIR__ );
$bases = array( 'Parse_This', 'MF2' );
foreach ( $bases as $base ) {
if ( strncmp( $class, $base, strlen( $base ) ) === 0 ) {
$filename = 'class-' . strtolower( str_replace( '_', '-', $class ) );
$file = $base_dir . $filename . '.php';
if ( file_exists( $file ) ) {
require $file;
}
}
}
}
);
10 changes: 9 additions & 1 deletion vendor/parse-this/includes/class-parse-this-rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public static function get_type( $feed ) {
}
}

public static function validate_email( $email ) {
$regexp = '/([a-z0-9_\.\-])+(\@|\[at\])+(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
preg_match( $regexp, $email, $match );
return is_array( $match ) ? $match[0] : '';
}

/*
* Takes a SimplePie_Author object and Turns it into a JF2 Author property
* @param SimplePie_Author $author
Expand All @@ -60,7 +66,7 @@ public static function get_authors( $author ) {
'type' => 'card',
'name' => htmlspecialchars_decode( $a->get_name() ),
'url' => $a->get_link(),
'email' => $a->get_email(),
'email' => self::validate_email( $a->get_email() ),
);
$dom = pt_load_domdocument( $r['name'] );
$links = $dom->getElementsByTagName( 'a' );
Expand Down Expand Up @@ -113,6 +119,8 @@ public static function source_to_cite( $source ) {
'name' => $source->get_title(),
'summary' => $source->get_description(),
'url' => $source->get_permalink(),
'author' => self::get_authors( $source->get_authors() ),
'photo' => $sourece->get_image_url(),
)
);
}
Expand Down
21 changes: 3 additions & 18 deletions vendor/parse-this/includes/class-parse-this.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct( $url = null ) {
}

public function get( $key = 'jf2' ) {
if ( 'mf2' === $key ) {
return jf2_to_mf2( $key );
}
if ( ! in_array( $key, get_object_vars( $this ), true ) ) {
$key = 'jf2';
}
Expand Down Expand Up @@ -164,9 +167,6 @@ public function fetch_feeds( $url = null ) {
}
// A feed was given
if ( $this->content instanceof SimplePie ) {
if ( ! class_exists( 'Parse_This_RSS', false ) ) {
require_once plugin_dir_path( __FILE__ ) . '/class-parse-this-rss.php';
}
return array(
'results' => array(
array(
Expand Down Expand Up @@ -318,9 +318,6 @@ public function fetch( $url = null ) {
return true;
}
if ( 'application/json' === $content_type ) {
if ( ! class_exists( 'Parse_This_JSONFeed', false ) ) {
require_once plugin_dir_path( __FILE__ ) . '/class-parse-this-jsonfeed.php';
}
$content = json_decode( $content, true );
if ( $content && isset( $content['version'] ) && 'https://jsonfeed.org/version/1' === $content['version'] ) {
$content = Parse_This_JSONFeed::to_jf2( $content, $url );
Expand Down Expand Up @@ -351,9 +348,6 @@ public function parse( $args = array() ) {
$this->jf2 = self::wp_post( $this->content );
return;
} elseif ( $this->content instanceof SimplePie ) {
if ( ! class_exists( 'Parse_This_RSS', false ) ) {
require_once plugin_dir_path( __FILE__ ) . '/class-parse-this-rss.php';
}
$this->jf2 = Parse_This_RSS::parse( $this->content, $this->url );
return;
} elseif ( $this->doc instanceof DOMDocument ) {
Expand All @@ -366,9 +360,6 @@ public function parse( $args = array() ) {
}
// Ensure not already preparsed
if ( empty( $this->jf2 ) ) {
if ( ! class_exists( 'Parse_This_MF2', false ) ) {
require_once plugin_dir_path( __FILE__ ) . '/class-parse-this-mf2.php';
}
$this->jf2 = Parse_This_MF2::parse( $content, $this->url, $args );
}
if ( ! isset( $this->jf2['url'] ) ) {
Expand All @@ -378,9 +369,6 @@ public function parse( $args = array() ) {
if ( ! $args['html'] ) {
return;
}
if ( ! class_exists( 'Parse_This_HTML', false ) ) {
require_once plugin_dir_path( __FILE__ ) . '/class-parse-this-html.php';
}
// If No MF2
if ( empty( $this->jf2 ) ) {
$args['alternate'] = true;
Expand All @@ -399,9 +387,6 @@ public function parse( $args = array() ) {
}

public static function wp_post( $post ) {
if ( ! class_exists( 'MF2_Post', false ) ) {
require_once plugin_dir_path( __FILE__ ) . '/class-mf2-post.php';
}
$mf2 = new MF2_Post( $post );
return $mf2->get( null, true );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php
/**
* Gathers Data for Link Previews
* Provides REST Endpoint to Retrieve the Parsed Data
*
* Parses Arbitrary URLs
*/

class Parse_This_API {
class REST_Parse_This {
public function __construct() {
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
Expand Down Expand Up @@ -74,17 +73,18 @@ public static function debug() {
* Register the Route.
*/
public static function register_routes() {
$cls = get_called_class();
register_rest_route(
'parse-this/1.0',
'/parse',
array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( 'Parse_This_API', 'read' ),
'callback' => array( $cls, 'read' ),
'args' => array(
'url' => array(
'required' => true,
'validate_callback' => array( 'Parse_This_API', 'is_valid_url' ),
'validate_callback' => array( $cls, 'is_valid_url' ),
'sanitize_callback' => 'esc_url_raw',
),
),
Expand All @@ -102,9 +102,6 @@ public static function read( $request ) {
$return = $request->get_param( 'return' );
$discovery = $request->get_param( 'discovery' );
$follow = $request->get_param( 'follow' );
if ( ! class_exists( 'Parse_This' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'class-parse-this.php';
}

$parse = new Parse_This( $url );
if ( $discovery ) {
Expand All @@ -123,7 +120,7 @@ public static function read( $request ) {
)
);
if ( $mf2 ) {
return jf2_to_mf2( $parse->get() );
return $parse->get( 'mf2' );
}
return $parse->get();
}
Expand All @@ -146,4 +143,4 @@ public static function addscheme( $url, $scheme = 'http://' ) {

}

new Parse_This_API();
new REST_Parse_This();
34 changes: 14 additions & 20 deletions vendor/parse-this/lib/html5/autoloader.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
<?php

// autoloader
spl_autoload_register( 'pt_html5_autoload' );

if ( ! class_exists( 'Masterminds\\HTML5' ) ) {
trigger_error( 'Autoloader not registered properly', E_USER_ERROR );
}

function pt_html5_autoload( $class ) {
//change this to your root namespace
$prefix = 'Masterminds';
//make sure this is the directory with your classes
$base_dir = __DIR__;
$len = strlen( $prefix );
if ( strncmp( $prefix, $class, $len ) !== 0 ) {
return;
}
$name = substr( $class, $len );
$file = __DIR__ . str_replace( '\\', '/', $name ) . '.php';
if ( file_exists( $file ) ) {
require $file;
spl_autoload_register(
function ( $class ) {
$prefix = 'Masterminds';
$base_dir = __DIR__;
$len = strlen( $prefix );
if ( strncmp( $prefix, $class, $len ) !== 0 ) {
return;
}
$name = substr( $class, $len );
$file = __DIR__ . str_replace( '\\', '/', $name ) . '.php';
if ( file_exists( $file ) ) {
require $file;
}
}
}
);
10 changes: 5 additions & 5 deletions vendor/parse-this/parse-this.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

if ( ! function_exists( 'parse_this_loader' ) ) {
function parse_this_loader() {
require_once plugin_dir_path( __FILE__ ) . 'includes/functions.php';
// Parse This API
require_once plugin_dir_path( __FILE__ ) . 'includes/class-parse-this-api.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/autoload.php';

// MF2 Post
require_once plugin_dir_path( __FILE__ ) . 'includes/class-mf2-post.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/functions.php';
// Parse This REST Endpoint
require_once plugin_dir_path( __FILE__ ) . 'includes/class-rest-parse-this.php';

}
add_action( 'plugins_loaded', 'parse_this_loader', 11 );
}

Loading

0 comments on commit afb6465

Please sign in to comment.