Skip to content

Commit eaecb72

Browse files
Merge pull request #16 from BeAPI/ver/1.2.0
Release 1.2.0
2 parents aa43878 + 961071f commit eaecb72

File tree

7 files changed

+25
-9
lines changed

7 files changed

+25
-9
lines changed

.plugin-data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "1.1.1",
2+
"version": "1.2.0",
33
"slug": "multisite-shared-blocks"
44
}

includes/Blocks/SharedBlock.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,20 @@ private function get_rendered_block( int $site_id, int $post_id, string $block_i
288288
sprintf( '/multisite-shared-blocks/v1/renderer/%d/%s', $post_id, $block_id )
289289
);
290290

291-
$response = wp_safe_remote_get( $rest_url );
291+
// Prepare request arguments
292+
$request_args = [];
293+
// Add authentication headers if in non-production environment and credentials are defined
294+
if ( defined( 'MULTISITE_BLOCKS_AUTH_USER' ) && defined( 'MULTISITE_BLOCKS_AUTH_PWD' ) && ! empty( MULTISITE_BLOCKS_AUTH_USER ) && ! empty( MULTISITE_BLOCKS_AUTH_PWD ) ) {
295+
$request_args = [
296+
'headers' => [
297+
'Authorization' => 'Basic ' . base64_encode( MULTISITE_BLOCKS_AUTH_USER . ':' . MULTISITE_BLOCKS_AUTH_PWD ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
298+
],
299+
];
300+
}
301+
302+
// Make the request with authentication if available
303+
$response = wp_safe_remote_get( $rest_url, $request_args );
304+
292305
if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
293306
return $block_data;
294307
}

multisite-shared-blocks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Multisite Shared Blocks
44
* Plugin URI: https://github.com/BeAPI/multisite-shared-blocks
55
* Description: Share blocks between network's sites.
6-
* Version: 1.1.1
6+
* Version: 1.2.0
77
* Requires at least: 5.9
88
* Requires PHP: 7.2
99
* Author: Be API Technical team
@@ -31,7 +31,7 @@
3131
}
3232

3333
// Plugin constants
34-
define( 'MULTISITE_SHARED_BLOCKS_VERSION', '1.1.1' );
34+
define( 'MULTISITE_SHARED_BLOCKS_VERSION', '1.2.0' );
3535
define( 'MULTISITE_SHARED_BLOCKS_CACHE_VERSION', '1' );
3636
define( 'MULTISITE_SHARED_BLOCKS_VIEWS_FOLDER_NAME', 'multisite-shared-blocks' );
3737

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "multisite-shared-blocks",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "Share blocks between network's sites.",
55
"main": "build/index.js",
66
"scripts": {

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: beapi, momo360modena, rahe, asadowski10, petitphp
33
Tags: network, multisite, block, share, gutenberg
44
Requires at least: 5.9
55
Tested up to: 6.4
6-
Stable tag: 1.1.1
6+
Stable tag: 1.2.0
77
Requires PHP: 7.2
88
License: GPL v2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -26,6 +26,9 @@ This plugin allow contributors to share blocks from posts on the network. Other
2626

2727
== Changelog ==
2828

29+
= 1.2.0 - 2025-09-12 =
30+
* Add Basic authentication support for multisite blocks requests
31+
2932
= 1.1.1 - 2024-03-29 =
3033
* Load translations for editor script
3134

src/blocks/shared-block/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 2,
44
"name": "multisite-shared-blocks/shared-block",
5-
"version": "1.1.1",
5+
"version": "1.2.0",
66
"title": "Shared Block",
77
"category": "design",
88
"description": "",

0 commit comments

Comments
 (0)