Skip to content

Commit

Permalink
Janitorial: Fix PHP Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
obenland committed Jan 6, 2025
1 parent 56fc7fa commit d90a35e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
6 changes: 6 additions & 0 deletions 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.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

* Undefined array key warnings in various places

## [4.6.0] - 2024-12-20

### Added
Expand Down
4 changes: 2 additions & 2 deletions includes/collection/class-interactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ public static function activity_to_comment( $activity ) {
return false;
}

$url = object_to_uri( $actor['url'] );
$url = object_to_uri( $actor['url'] ?? $actor['id'] );

if ( ! $url ) {
object_to_uri( $actor['id'] );
$url = object_to_uri( $actor['id'] );
}

if ( isset( $activity['object']['content'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/transformer/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ public function get_in_reply_to() {
$blocks = \parse_blocks( $this->wp_object->post_content );

foreach ( $blocks as $block ) {
if ( 'activitypub/reply' === $block['blockName'] ) {
if ( 'activitypub/reply' === $block['blockName'] && isset( $block['attrs']['url'] ) ) {
// We only support one reply block per post for now.
return $block['attrs']['url'];
}
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ For reasons of data protection, it is not possible to see the followers of other

== Changelog ==

= Unreleased =

* Fixed: Undefined array key warnings in various places

= 4.6.0 =

* Added: A filter to allow modifying the ActivityPub preview template
Expand Down
4 changes: 2 additions & 2 deletions templates/post-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<body>
<div class="columns">
<aside class="sidebar">
<input type="search" disabled="disabled" placeholder="<?php echo esc_html_e( 'Search', 'activitypub' ); ?>" disabled="disabled" />
<input type="search" disabled="disabled" placeholder="<?php esc_html_e( 'Search', 'activitypub' ); ?>" />
<div>
<div class="fake-image"></div>
<div>
Expand Down Expand Up @@ -218,7 +218,7 @@
<div class="attachments">
<?php foreach ( $object->get_attachment() as $attachment ) : ?>
<?php if ( 'Image' === $attachment['type'] ) : ?>
<img src="<?php echo esc_url( $attachment['url'] ); ?>" alt="<?php echo esc_attr( $attachment['name'] ); ?>" />
<img src="<?php echo esc_url( $attachment['url'] ); ?>" alt="<?php echo esc_attr( $attachment['name'] ?? '' ); ?>" />
<?php endif; ?>
<?php endforeach; ?>
</div>
Expand Down

0 comments on commit d90a35e

Please sign in to comment.