Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ This is a syndication format, which means it only represents your posts and comm

## Changelog

### 1.4.5

* Sanity check on $max_page
* Add filter `jsonfeed_comments_feed_enable`, which if set to false will disable the comments feed header.
* Add mime type for jsonfeed to filter for W3C Cache Plugin per GitHub issue 67.

### 1.4.4

* Fix declaration error
Expand Down
2 changes: 1 addition & 1 deletion feed-json-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function get_link_from_json_feed( $link ) {

function get_json_feed_next_url() {
global $paged, $wp_query;
$max_page = $wp_query->max_num_pages;
$max_page = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;

$nextpage = ( ! $paged ) ? 2 : (int) $paged + 1;

Expand Down
23 changes: 16 additions & 7 deletions jsonfeed-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: JSON Feed
Plugin URI: https://github.com/manton/jsonfeed-wp/
Description: Adds a feed of recent posts in JSON Feed format.
Version: 1.4.4
Version: 1.4.5
Author: Manton Reece and Daniel Jalkut
Text Domain: jsonfeed
License: GPL2.0+
Expand All @@ -28,10 +28,10 @@ function do_feed_json( $for_comments ) {
header( 'Access-Control-Allow-Origin: *' );

if ( $for_comments ) {
load_template( dirname( __FILE__ ) . '/feed-json-comments.php' );
load_template( __DIR__ . '/feed-json-comments.php' );
} else {

load_template( dirname( __FILE__ ) . '/feed-json.php' );
load_template( __DIR__ . '/feed-json.php' );
}
}

Expand All @@ -43,6 +43,14 @@ function json_feed_content_type( $content_type, $type ) {
return $content_type;
}


function json_feed_w3tc_is_cacheable_content_type( $types ) {
$types[] = 'application/feed+json';
return array_unique( $types );
}

add_filter( 'w3tc_is_cacheable_content_type', 'json_feed_w3tc_is_cacheable_content_type' );

add_action( 'wp_head', 'json_feed_link' );
function json_feed_link() {
printf(
Expand Down Expand Up @@ -79,9 +87,10 @@ function json_feed_links_extra( $args = array() ) {
);
$args = wp_parse_args( $args, $defaults );
if ( is_singular() ) {
$id = 0;
$post = get_post( $id );
if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
$id = 0;
$post = get_post( $id );
$comments = apply_filters( 'jsonfeed_comments_feed_enable', true );
if ( $comments && ( comments_open() || pings_open() || $post->comment_count > 0 ) ) {
$title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );
$href = get_post_comments_feed_link( $post->ID, 'json' );
}
Expand Down Expand Up @@ -145,4 +154,4 @@ function json_feed_websub( $feed_types ) {
}
add_filter( 'pubsubhubbub_supported_feed_types', 'json_feed_websub' );

require_once dirname( __FILE__ ) . '/feed-json-functions.php';
require_once __DIR__ . '/feed-json-functions.php';
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<file>./feed-json-comments.php</file>
<file>./feed-json-functions.php</file>
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="5.4-"/>
<config name="testVersion" value="5.6-"/>
<rule ref="WordPress-Core" />
<config name="minimum_supported_wp_version" value="4.9"/>
<rule ref="WordPress.Files.FileName" />
Expand Down
11 changes: 8 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: mantonr, redsweater, dshanske
Tags: jsonfeed, json, feed, feeds
Requires at least: 4.9
Tested up to: 6.2
Requires PHP: 5.4
Stable tag: 1.4.4
Tested up to: 6.3
Requires PHP: 5.6
Stable tag: 1.4.5
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -47,6 +47,11 @@ This is a syndication format, which means it only represents your posts and comm

== Changelog ==

= 1.4.5 =
* Sanity check on $max_page
* Add filter `jsonfeed_comments_feed_enable`, which if set to false will disable the comments feed header.
* Add mime type for jsonfeed to filter for W3C Cache Plugin per GitHub issue 67.

= 1.4.4 =
* Fix declaration error

Expand Down