@automattic/newspack-blocks 4.3.5 → 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/includes/class-newspack-blocks.php +25 -33
- package/newspack-blocks.php +2 -2
- package/package.json +1 -1
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +2 -2
- package/vendor/composer/installed.php +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.3.6](https://github.com/Automattic/newspack-blocks/compare/v4.3.5...v4.3.6) (2024-11-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* trigger release with HPP fix ([2c8c1e6](https://github.com/Automattic/newspack-blocks/commit/2c8c1e6030e6a2b0777ee2756bb2d7196f74fca9))
|
|
7
|
+
|
|
1
8
|
## [4.3.5](https://github.com/Automattic/newspack-blocks/compare/v4.3.4...v4.3.5) (2024-11-11)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -674,19 +674,16 @@ class Newspack_Blocks {
|
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
|
|
677
|
-
$is_co_authors_plus_active = class_exists( '
|
|
677
|
+
$is_co_authors_plus_active = class_exists( 'CoAuthors_Plus' );
|
|
678
|
+
$co_authors_guest_authors = class_exists( 'CoAuthors_Guest_Authors' ) ? new CoAuthors_Guest_Authors() : null;
|
|
678
679
|
|
|
679
680
|
if ( $authors && count( $authors ) ) {
|
|
680
681
|
$co_authors_names = [];
|
|
681
|
-
$author_names = [];
|
|
682
|
-
$author_emails = [];
|
|
683
682
|
|
|
684
683
|
if ( $is_co_authors_plus_active ) {
|
|
685
|
-
$co_authors_guest_authors = new CoAuthors_Guest_Authors();
|
|
686
|
-
|
|
687
684
|
foreach ( $authors as $index => $author_id ) {
|
|
688
685
|
// If the given ID is a guest author.
|
|
689
|
-
$co_author = $co_authors_guest_authors->get_guest_author_by( 'id', $author_id );
|
|
686
|
+
$co_author = $co_authors_guest_authors ? $co_authors_guest_authors->get_guest_author_by( 'id', $author_id ) : null;
|
|
690
687
|
if ( $co_author ) {
|
|
691
688
|
if ( ! empty( $co_author->linked_account ) ) {
|
|
692
689
|
$linked_account = get_user_by( 'login', $co_author->linked_account );
|
|
@@ -697,20 +694,23 @@ class Newspack_Blocks {
|
|
|
697
694
|
$co_authors_names[] = $co_author->user_nicename;
|
|
698
695
|
unset( $authors[ $index ] );
|
|
699
696
|
} else {
|
|
700
|
-
// If the given ID is linked to a guest author.
|
|
701
697
|
$authors_controller = new WP_REST_Newspack_Authors_Controller();
|
|
702
698
|
$author_data = get_userdata( $author_id );
|
|
703
699
|
if ( $author_data ) {
|
|
704
700
|
$linked_guest_author = $authors_controller->get_linked_guest_author( $author_data->user_login );
|
|
701
|
+
// If the given ID is linked to a guest author.
|
|
705
702
|
if ( $linked_guest_author ) {
|
|
706
703
|
$guest_author_name = sanitize_title( $linked_guest_author->post_title );
|
|
707
704
|
if ( ! in_array( $guest_author_name, $co_authors_names, true ) ) {
|
|
708
705
|
$co_authors_names[] = $guest_author_name;
|
|
706
|
+
$co_authors_names[] = $linked_guest_author->post_name;
|
|
709
707
|
unset( $authors[ $index ] );
|
|
710
708
|
}
|
|
711
709
|
} else {
|
|
712
|
-
$
|
|
713
|
-
$
|
|
710
|
+
$co_authors_names[] = $author_data->user_login;
|
|
711
|
+
$co_authors_names[] = $author_data->user_nicename;
|
|
712
|
+
$co_authors_names[] = 'cap-' . $author_data->user_nicename;
|
|
713
|
+
$co_authors_names[] = $author_data->user_email;
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
}
|
|
@@ -719,9 +719,16 @@ class Newspack_Blocks {
|
|
|
719
719
|
|
|
720
720
|
// Reset numeric indexes.
|
|
721
721
|
$authors = array_values( $authors );
|
|
722
|
+
|
|
722
723
|
if ( empty( $authors ) && count( $co_authors_names ) ) {
|
|
723
|
-
//
|
|
724
|
+
// We are only looking for Guest Authors posts. So we need to only search by taxonomy.
|
|
724
725
|
$args['tax_query'] = [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
|
|
726
|
+
'relation' => 'OR',
|
|
727
|
+
[
|
|
728
|
+
'field' => 'slug',
|
|
729
|
+
'taxonomy' => 'author',
|
|
730
|
+
'terms' => $co_authors_names,
|
|
731
|
+
],
|
|
725
732
|
[
|
|
726
733
|
'field' => 'name',
|
|
727
734
|
'taxonomy' => 'author',
|
|
@@ -729,32 +736,11 @@ class Newspack_Blocks {
|
|
|
729
736
|
],
|
|
730
737
|
];
|
|
731
738
|
} elseif ( empty( $co_authors_names ) && count( $authors ) ) {
|
|
739
|
+
// Simple search by author. Co-Authors plus is not active.
|
|
732
740
|
$args['author__in'] = $authors;
|
|
733
|
-
|
|
734
|
-
if ( $is_co_authors_plus_active ) {
|
|
735
|
-
// Don't get any posts that are attributed to other CAP guest authors.
|
|
736
|
-
$args['tax_query'] = [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
|
|
737
|
-
[
|
|
738
|
-
'relation' => 'OR',
|
|
739
|
-
[
|
|
740
|
-
'taxonomy' => 'author',
|
|
741
|
-
'operator' => 'NOT EXISTS',
|
|
742
|
-
],
|
|
743
|
-
[
|
|
744
|
-
'field' => 'name',
|
|
745
|
-
'taxonomy' => 'author',
|
|
746
|
-
'terms' => $author_names,
|
|
747
|
-
],
|
|
748
|
-
[
|
|
749
|
-
'field' => 'name',
|
|
750
|
-
'taxonomy' => 'author',
|
|
751
|
-
'terms' => $author_emails,
|
|
752
|
-
],
|
|
753
|
-
],
|
|
754
|
-
];
|
|
755
|
-
}
|
|
756
741
|
} else {
|
|
757
742
|
// The query contains both WP users and CAP guest authors. We need to filter the SQL query.
|
|
743
|
+
// That's because author__in and tax_query would be combined with AND, not OR.
|
|
758
744
|
self::$filter_clauses = [
|
|
759
745
|
'authors' => $authors,
|
|
760
746
|
'coauthors' => $co_authors_names,
|
|
@@ -1254,11 +1240,17 @@ class Newspack_Blocks {
|
|
|
1254
1240
|
|
|
1255
1241
|
// co-author tax query.
|
|
1256
1242
|
$tax_query = [
|
|
1243
|
+
'relation' => 'OR',
|
|
1257
1244
|
[
|
|
1258
1245
|
'taxonomy' => 'author',
|
|
1259
1246
|
'field' => 'name',
|
|
1260
1247
|
'terms' => $co_authors_names,
|
|
1261
1248
|
],
|
|
1249
|
+
[
|
|
1250
|
+
'taxonomy' => 'author',
|
|
1251
|
+
'field' => 'slug',
|
|
1252
|
+
'terms' => $co_authors_names,
|
|
1253
|
+
],
|
|
1262
1254
|
];
|
|
1263
1255
|
|
|
1264
1256
|
// Generate the tax query SQL.
|
package/newspack-blocks.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Author URI: https://newspack.com/
|
|
8
8
|
* Text Domain: newspack-blocks
|
|
9
9
|
* Domain Path: /languages
|
|
10
|
-
* Version: 4.3.
|
|
10
|
+
* Version: 4.3.6
|
|
11
11
|
*
|
|
12
12
|
* @package Newspack_Blocks
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
define( 'NEWSPACK_BLOCKS__PLUGIN_FILE', __FILE__ );
|
|
16
16
|
define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
|
|
17
17
|
define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( NEWSPACK_BLOCKS__PLUGIN_FILE ) );
|
|
18
|
-
define( 'NEWSPACK_BLOCKS__VERSION', '4.3.
|
|
18
|
+
define( 'NEWSPACK_BLOCKS__VERSION', '4.3.6' );
|
|
19
19
|
|
|
20
20
|
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks.php';
|
|
21
21
|
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks-api.php';
|
package/package.json
CHANGED
package/vendor/autoload.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInit709658e8801f92df48c90150e6ddf243
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit6f4d6c031f1540c9d97907cfac9baedb
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInit709658e8801f92df48c90150e6ddf243', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInit709658e8801f92df48c90150e6ddf243', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInit709658e8801f92df48c90150e6ddf243::getInitializer($loader));
|
|
31
31
|
|
|
32
32
|
$loader->register(true);
|
|
33
33
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
namespace Composer\Autoload;
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ComposerStaticInit709658e8801f92df48c90150e6ddf243
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInit6f4d6c031f1540c9d97907cfac9baedb
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInit709658e8801f92df48c90150e6ddf243::$classMap;
|
|
17
17
|
|
|
18
18
|
}, null, ClassLoader::class);
|
|
19
19
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'name' => 'automattic/newspack-blocks',
|
|
4
4
|
'pretty_version' => 'dev-trunk',
|
|
5
5
|
'version' => 'dev-trunk',
|
|
6
|
-
'reference' => '
|
|
6
|
+
'reference' => '2c8c1e6030e6a2b0777ee2756bb2d7196f74fca9',
|
|
7
7
|
'type' => 'wordpress-plugin',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
'automattic/newspack-blocks' => array(
|
|
14
14
|
'pretty_version' => 'dev-trunk',
|
|
15
15
|
'version' => 'dev-trunk',
|
|
16
|
-
'reference' => '
|
|
16
|
+
'reference' => '2c8c1e6030e6a2b0777ee2756bb2d7196f74fca9',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|