Skip to content

Commit

Permalink
Merge branch 'trunk' into add/outbox-collection
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle authored Oct 22, 2024
2 parents 8c0c3fa + bf2912c commit 3eb8ca6
Show file tree
Hide file tree
Showing 107 changed files with 4,024 additions and 2,307 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ tests
node_modules
vendor
src
docs
7 changes: 3 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[{.jshintrc,*.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = lf
[*.md]
trim_trailing_whitespace = false
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Bug Report
description: Helps us improve our product!
labels: "Needs triage, [Type] Bug"
labels: [ 'Needs triage', '[Type] Bug' ]
type: 'Bug'
body:
- type: markdown
attributes:
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Feature Request
description: Suggest an idea for the ActivityPub plugin!
title: "Feature Request:"
labels: ["[Type] Feature Request"]
type: 'Enhancement'
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Detect coding standard violations
run: ./vendor/bin/phpcs -n -q
run: ./vendor/bin/phpcs
4 changes: 4 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
- wp-version: '6.5'
php-versions: '7.1'
steps:
- name: Install svn
run: |
sudo apt-get update
sudo apt-get install subversion
- name: Checkout
uses: actions/checkout@v2

Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ 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).

## [3.3.3] - 2024-10-09

### Fixed

* Sanitization callback

### Improved

* A lot of PHPCS cleanups
* Prepare multi-lang support

## [3.3.2] - 2024-10-02

### Fixed

* Keep priority of Icons
* Fatal error if remote-object is `WP_Error`

### Improved

* Adopt WordPress PHP Coding Standards

## [3.3.1] - 2024-09-26

### Fixed
Expand Down Expand Up @@ -947,6 +969,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* initial

[3.3.3]: https://github.com/Automattic/wordpress-activitypub/compare/3.3.2...3.3.3
[3.3.2]: https://github.com/Automattic/wordpress-activitypub/compare/3.3.1...3.3.2
[3.3.1]: https://github.com/Automattic/wordpress-activitypub/compare/3.3.0...3.3.1
[3.3.0]: https://github.com/Automattic/wordpress-activitypub/compare/3.2.5...3.3.0
[3.2.5]: https://github.com/Automattic/wordpress-activitypub/compare/3.2.4...3.2.5
Expand Down
4 changes: 2 additions & 2 deletions FEDERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ The WordPress plugin largely follows ActivityPub's server-to-server specificatio
## Supported federation protocols and standards

- [ActivityPub](https://www.w3.org/TR/activitypub/) (Server-to-Server)
- [WebFinger](https://webfinger.net/)
- [HTTP Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures)
- [WebFinger](https://swicg.github.io/activitypub-http-signature/)
- [HTTP Signatures](https://www.w3.org/community/reports/socialcg/CG-FINAL-apwf-20240608/)
- [NodeInfo](https://nodeinfo.diaspora.software/)

## Supported FEPs
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** OStatus, fediverse, activitypub, activitystream
**Requires at least:** 5.5
**Tested up to:** 6.6
**Stable tag:** 3.3.1
**Stable tag:** 3.3.3
**Requires PHP:** 7.0
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT
Expand Down Expand Up @@ -150,6 +150,18 @@ For reasons of data protection, it is not possible to see the followers of other

## Changelog ##

### 3.3.3 ###

* Fixed: Sanitization callback
* Improved: A lot of PHPCS cleanups
* Improved: Prepare multi-lang support

### 3.3.2 ###

* Fixed: Keep priority of Icons
* Fixed: Fatal error if remote-object is `WP_Error`
* Improved: Adopt WordPress PHP Coding Standards

### 3.3.1 ###

* Fixed: PHP Warnings
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

48 changes: 31 additions & 17 deletions activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,60 @@
* Plugin Name: ActivityPub
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
* Version: 3.3.1
* Version: 3.3.3
* Author: Matthias Pfefferle & Automattic
* Author URI: https://automattic.com/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
* Requires PHP: 7.0
* Text Domain: activitypub
* Domain Path: /languages
*
* @package Activitypub
*/

namespace Activitypub;

use WP_CLI;

use function Activitypub\is_blog_public;
use function Activitypub\site_supports_blocks;

require_once __DIR__ . '/includes/compat.php';
require_once __DIR__ . '/includes/functions.php';

\define( 'ACTIVITYPUB_PLUGIN_VERSION', '3.3.1' );
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '4.0.0' );

/**
* Initialize the plugin constants.
*/
\defined( 'ACTIVITYPUB_REST_NAMESPACE' ) || \define( 'ACTIVITYPUB_REST_NAMESPACE', 'activitypub/1.0' );
\defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 );
\defined( 'ACTIVITYPUB_NOTE_LENGTH' ) || \define( 'ACTIVITYPUB_NOTE_LENGTH', 400 );
\defined( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS' ) || \define( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS', true );
\defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 );
\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=<p>)|(?<=<br>)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
\defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9\._-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' );
\defined( 'ACTIVITYPUB_URL_REGEXP' ) || \define( 'ACTIVITYPUB_URL_REGEXP', '(www.|http:|https:)+[^\s]+[\w\/]' );
\defined( 'ACTIVITYPUB_URL_REGEXP' ) || \define( 'ACTIVITYPUB_URL_REGEXP', '(https?:|www\.)\S+[\w\/]' );
\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<h2>[ap_title]</h2>\n\n[ap_content]\n\n[ap_hashtags]\n\n[ap_shortlink]" );
\defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) || \define( 'ACTIVITYPUB_AUTHORIZED_FETCH', false );
\defined( 'ACTIVITYPUB_DISABLE_REWRITES' ) || \define( 'ACTIVITYPUB_DISABLE_REWRITES', false );
\defined( 'ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS' ) || \define( 'ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS', false );
// Disable reactions like `Like` and `Announce` by default
// Disable reactions like `Like` and `Announce` by default.
\defined( 'ACTIVITYPUB_DISABLE_REACTIONS' ) || \define( 'ACTIVITYPUB_DISABLE_REACTIONS', true );
\defined( 'ACTIVITYPUB_DISABLE_OUTGOING_INTERACTIONS' ) || \define( 'ACTIVITYPUB_DISABLE_OUTGOING_INTERACTIONS', false );
\defined( 'ACTIVITYPUB_SHARED_INBOX_FEATURE' ) || \define( 'ACTIVITYPUB_SHARED_INBOX_FEATURE', false );
\defined( 'ACTIVITYPUB_SEND_VARY_HEADER' ) || \define( 'ACTIVITYPUB_SEND_VARY_HEADER', false );
\defined( 'ACTIVITYPUB_DEFAULT_OBJECT_TYPE' ) || \define( 'ACTIVITYPUB_DEFAULT_OBJECT_TYPE', 'note' );

// Define Actor-Modes for the plugin.
\define( 'ACTIVITYPUB_ACTOR_MODE', 'actor' );
\define( 'ACTIVITYPUB_BLOG_MODE', 'blog' );
\define( 'ACTIVITYPUB_ACTOR_AND_BLOG_MODE', 'actor_blog' );

// Post visibility constants.
\define( 'ACTIVITYPUB_CONTENT_VISIBILITY_PUBLIC', '' );
\define( 'ACTIVITYPUB_CONTENT_VISIBILITY_QUIET_PUBLIC', 'quiet_public' );
\define( 'ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL', 'local' );

// Plugin related constants.
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
Expand All @@ -66,7 +77,7 @@ function rest_init() {
Rest\Collection::init();
Rest\Interaction::init();

// load NodeInfo endpoints only if blog is public
// Load NodeInfo endpoints only if blog is public.
if ( is_blog_public() ) {
Rest\NodeInfo::init();
}
Expand Down Expand Up @@ -103,7 +114,7 @@ function plugin_init() {


/**
* Class Autoloader
* Class Autoloader.
*/
\spl_autoload_register(
function ( $full_class ) {
Expand All @@ -112,7 +123,7 @@ function ( $full_class ) {

if ( strncmp( $full_class, $base, strlen( $base ) ) === 0 ) {
$maybe_uppercase = str_replace( $base, '', $full_class );
$class = strtolower( $maybe_uppercase );
$class = strtolower( $maybe_uppercase );
// All classes should be capitalized. If this is instead looking for a lowercase method, we ignore that.
if ( $maybe_uppercase === $class ) {
return;
Expand All @@ -131,7 +142,7 @@ function ( $full_class ) {
if ( file_exists( $file ) && is_readable( $file ) ) {
require_once $file;
} else {
// translators: %s is the class name
// translators: %s is the class name.
$message = sprintf( esc_html__( 'Required class not found or not readable: %s', 'activitypub' ), esc_html( $full_class ) );
Debug::write_log( $message );
\wp_die( $message ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
Expand All @@ -141,10 +152,12 @@ function ( $full_class ) {
);

/**
* Add plugin settings link
* Add plugin settings link.
*
* @param array $actions The current actions.
*/
function plugin_settings_link( $actions ) {
$settings_link = array();
$settings_link = array();
$settings_link[] = \sprintf(
'<a href="%1s">%2s</a>',
\menu_page_url( 'activitypub', false ),
Expand Down Expand Up @@ -179,13 +192,14 @@ function plugin_settings_link( $actions ) {
)
);

// Load integrations
// Load integrations.
require_once __DIR__ . '/integration/load.php';

/**
* `get_plugin_data` wrapper
* `get_plugin_data` wrapper.
*
* @return array The plugin metadata array
* @param array $default_headers Optional. The default plugin headers. Default empty array.
* @return array The plugin metadata array.
*/
function get_plugin_meta( $default_headers = array() ) {
if ( ! $default_headers ) {
Expand Down Expand Up @@ -221,7 +235,7 @@ function get_plugin_version() {
return $meta['Version'];
}

// Check for CLI env, to add the CLI commands
// Check for CLI env, to add the CLI commands.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
WP_CLI::add_command(
'activitypub',
Expand Down
2 changes: 1 addition & 1 deletion build/editor-plugin/plugin.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '88603987940fec29730d');
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => '92b35e5bbecef58deaf6');
2 changes: 1 addition & 1 deletion build/editor-plugin/plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"vendor/bin/phpunit"
],
"lint": [
"vendor/bin/phpcs -n -q"
"vendor/bin/phpcs"
],
"lint:fix": [
"vendor/bin/phpcbf"
Expand Down
Empty file added docs/.keep
Empty file.
Loading

0 comments on commit 3eb8ca6

Please sign in to comment.