Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an early return filter for get_upload_dir() #1008

Merged
merged 12 commits into from
Nov 22, 2024
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Dev - XXXX-XX-XX

### Added

* A `pre_activitypub_get_upload_baseurl` filter
* GitHub action to enforce Changelog updates.

### Improved

* Outsource Constants to a separate file
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ For reasons of data protection, it is not possible to see the followers of other

### Dev ###

* Added: A `pre_activitypub_get_upload_baseurl` filter
* Added: GitHub action to enforce Changelog updates.
* Improved: Outsource Constants to a separate file

### 4.2.1 ###
Expand Down
4 changes: 2 additions & 2 deletions activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* 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: 4.2.1
* Version: 4.2.2
* Author: Matthias Pfefferle & Automattic
* Author URI: https://automattic.com/
* License: MIT
Expand All @@ -19,7 +19,7 @@

use WP_CLI;

\define( 'ACTIVITYPUB_PLUGIN_VERSION', '4.2.1' );
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '4.2.2' );

// Plugin related constants.
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
Expand Down
10 changes: 10 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,16 @@ function get_attribution_domains() {
* @return string The upload base URL.
*/
function get_upload_baseurl() {
/**
* Early filter to allow plugins to set the upload base URL.
*
* @param string|false $maybe_upload_dir The upload base URL or false if not set.
*/
$maybe_upload_dir = apply_filters( 'pre_activitypub_get_upload_baseurl', false );
pfefferle marked this conversation as resolved.
Show resolved Hide resolved
if ( false !== $maybe_upload_dir ) {
return $maybe_upload_dir;
}

$upload_dir = \wp_get_upload_dir();

/**
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ For reasons of data protection, it is not possible to see the followers of other

= Dev =

* Added: A `pre_activitypub_get_upload_baseurl` filter
* Added: GitHub action to enforce Changelog updates.
* Improved: Outsource Constants to a separate file

Expand Down
Loading