Skip to content

Commit

Permalink
Release 3.0.1 (#548)
Browse files Browse the repository at this point in the history
* Fix metadata on password protected posts (#547)

* Fix post trackable status

* Fix linting

* Adding filter to disable behavior

* Update tests/Integration/OtherTest.php

Co-authored-by: Jeff Bowen <[email protected]>

Co-authored-by: Jeff Bowen <[email protected]>

* Bumping version number

* Updating README

Co-authored-by: Jeff Bowen <[email protected]>
  • Loading branch information
pauarge and jblz authored Dec 17, 2021
1 parent 26cfdf1 commit a525cad
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 6 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.1] - 2021-12-17

### Fixed

- Fix metadata on password protected posts [#547](https://github.com/Parsely/wp-parsely/pull/547)

## [3.0.0] - 2021-12-15

## Important information about this release
Expand Down Expand Up @@ -421,8 +427,9 @@ If you are using the plugin without any code-level customizations (for instance,
## [v1.0] - 2012-07-15

- Initial version.
- Add sSupport for parsely-page and JavaScript on home page and published pages and posts as well as archive pages (date/author/category/tag).
- Add support for parsely-page and JavaScript on home page and published pages and posts as well as archive pages (date/author/category/tag).

[3.0.1]: https://github.com/Parsely/wp-parsely/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/Parsely/wp-parsely/compare/2.6.1...3.0.0
[2.6.1]: https://github.com/Parsely/wp-parsely/compare/2.6.0...2.6.1
[2.6.0]: https://github.com/Parsely/wp-parsely/compare/2.5.2...2.6.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Parse.ly

Stable tag: 3.0.0
Stable tag: 3.0.1
Requires at least: 5.0
Tested up to: 5.8
Requires PHP: 7.1
Expand Down
20 changes: 18 additions & 2 deletions src/class-parsely.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,22 @@ public static function post_has_trackable_status( $post ): bool {
return $cache[ $post_id ];
}

/**
* Filters whether the post password check should be skipped when getting the post trackable status.
*
* @since 3.0.1
*
* @param bool $skip True if the password check should be skipped.
* @param int|WP_Post $post Which post object or ID is being checked.
*
* @returns bool
*/
$skip_password_check = apply_filters( 'wp_parsely_skip_post_password_check', false, $post );
if ( ! $skip_password_check && post_password_required( $post ) ) {
$cache[ $post_id ] = false;
return false;
}

/**
* Filters the statuses that are permitted to be tracked.
*
Expand Down Expand Up @@ -442,11 +458,11 @@ public function construct_parsely_metadata( array $parsely_options, WP_Post $pos
$parsely_page['articleSection'] = $category;
$author_objects = array();
foreach ( $authors as $author ) {
$author_tag = array(
$author_tag = array(
'@type' => 'Person',
'name' => $author,
);
array_push( $author_objects, $author_tag );
$author_objects[] = $author_tag;
}
$parsely_page['author'] = $author_objects;
$parsely_page['creator'] = $authors;
Expand Down
36 changes: 36 additions & 0 deletions tests/Integration/OtherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,40 @@ public function test_corrupted_options(): void {
$options = self::$parsely->get_options();
self::assertSame( self::EMPTY_DEFAULT_OPTIONS, $options );
}

/**
* Test if post is trackable when it is password protected.
*
* @since 3.0.1
*
* @covers \Parsely\Parsely::post_has_trackable_status
*/
public function test_post_has_trackable_status_password_protected(): void {
$post_id = $this->factory->post->create();
$post = get_post( $post_id );

$post->post_password = 'somepassword';

$result = Parsely::post_has_trackable_status( $post );
self::assertFalse( $result );
}

/**
* Test if post is trackable when it is password protected and a filter disables it.
*
* @since 3.0.1
*
* @covers \Parsely\Parsely::post_has_trackable_status
*/
public function test_post_has_trackable_status_password_protected_with_filter(): void {
add_filter( 'wp_parsely_skip_post_password_check', '__return_true' );

$post_id = $this->factory->post->create();
$post = get_post( $post_id );

$post->post_password = 'somepassword';

$result = Parsely::post_has_trackable_status( $post );
self::assertTrue( $result );
}
}
4 changes: 2 additions & 2 deletions wp-parsely.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Parse.ly
* Plugin URI: https://www.parse.ly/help/integration/wordpress
* Description: This plugin makes it a snap to add Parse.ly tracking code to your WordPress blog.
* Version: 3.0.0
* Version: 3.0.1
* Author: Parse.ly
* Author URI: https://www.parse.ly
* Text Domain: wp-parsely
Expand Down Expand Up @@ -39,7 +39,7 @@
return;
}

const PARSELY_VERSION = '3.0.0';
const PARSELY_VERSION = '3.0.1';
const PARSELY_FILE = __FILE__;

require __DIR__ . '/src/class-parsely.php';
Expand Down

0 comments on commit a525cad

Please sign in to comment.