Skip to content

Commit 3dac6c1

Browse files
authored
Janitorial: Fix PHP Warnings (#1127)
1 parent 56fc7fa commit 3dac6c1

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
12+
* Undefined array key warnings in various places
13+
814
## [4.6.0] - 2024-12-20
915

1016
### Added

includes/collection/class-interactions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ public static function activity_to_comment( $activity ) {
246246
return false;
247247
}
248248

249-
$url = object_to_uri( $actor['url'] );
249+
$url = object_to_uri( $actor['url'] ?? $actor['id'] );
250250

251251
if ( ! $url ) {
252-
object_to_uri( $actor['id'] );
252+
$url = object_to_uri( $actor['id'] );
253253
}
254254

255255
if ( isset( $activity['object']['content'] ) ) {

includes/transformer/class-post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ public function get_in_reply_to() {
11141114
$blocks = \parse_blocks( $this->wp_object->post_content );
11151115

11161116
foreach ( $blocks as $block ) {
1117-
if ( 'activitypub/reply' === $block['blockName'] ) {
1117+
if ( 'activitypub/reply' === $block['blockName'] && isset( $block['attrs']['url'] ) ) {
11181118
// We only support one reply block per post for now.
11191119
return $block['attrs']['url'];
11201120
}

readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ For reasons of data protection, it is not possible to see the followers of other
132132

133133
== Changelog ==
134134

135+
= Unreleased =
136+
137+
* Fixed: Undefined array key warnings in various places
138+
135139
= 4.6.0 =
136140

137141
* Added: A filter to allow modifying the ActivityPub preview template

templates/post-preview.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
<body>
180180
<div class="columns">
181181
<aside class="sidebar">
182-
<input type="search" disabled="disabled" placeholder="<?php echo esc_html_e( 'Search', 'activitypub' ); ?>" disabled="disabled" />
182+
<input type="search" disabled="disabled" placeholder="<?php esc_html_e( 'Search', 'activitypub' ); ?>" />
183183
<div>
184184
<div class="fake-image"></div>
185185
<div>
@@ -218,7 +218,7 @@
218218
<div class="attachments">
219219
<?php foreach ( $object->get_attachment() as $attachment ) : ?>
220220
<?php if ( 'Image' === $attachment['type'] ) : ?>
221-
<img src="<?php echo esc_url( $attachment['url'] ); ?>" alt="<?php echo esc_attr( $attachment['name'] ); ?>" />
221+
<img src="<?php echo esc_url( $attachment['url'] ); ?>" alt="<?php echo esc_attr( $attachment['name'] ?? '' ); ?>" />
222222
<?php endif; ?>
223223
<?php endforeach; ?>
224224
</div>

0 commit comments

Comments
 (0)