From e915b7af8b498aeb843d47cc69cf12ffe01ebd23 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 23 Dec 2023 20:31:36 +0100 Subject: [PATCH] fix #620 --- README.md | 2 +- includes/class-activitypub.php | 12 ++++++------ includes/compat.php | 21 +++++++++++++++++++++ readme.txt | 2 +- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index da17996..9676bc0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ActivityPub # **Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/), [cavalierlife](https://profiles.wordpress.org/cavalierlife/) **Tags:** OStatus, fediverse, activitypub, activitystream -**Requires at least:** 4.7 +**Requires at least:** 5.5 **Tested up to:** 6.4 **Stable tag:** 1.3.0 **Requires PHP:** 5.6 diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index 8b2a405..16d417c 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -389,7 +389,7 @@ class Activitypub { * @return void */ private static function register_post_types() { - register_post_type( + \register_post_type( Followers::POST_TYPE, array( 'labels' => array( @@ -406,7 +406,7 @@ class Activitypub { ) ); - register_post_meta( + \register_post_meta( Followers::POST_TYPE, 'activitypub_inbox', array( @@ -416,7 +416,7 @@ class Activitypub { ) ); - register_post_meta( + \register_post_meta( Followers::POST_TYPE, 'activitypub_errors', array( @@ -432,7 +432,7 @@ class Activitypub { ) ); - register_post_meta( + \register_post_meta( Followers::POST_TYPE, 'activitypub_user_id', array( @@ -444,7 +444,7 @@ class Activitypub { ) ); - register_post_meta( + \register_post_meta( Followers::POST_TYPE, 'activitypub_actor_json', array( @@ -456,7 +456,7 @@ class Activitypub { ) ); - do_action( 'activitypub_after_register_post_type' ); + \do_action( 'activitypub_after_register_post_type' ); } /** diff --git a/includes/compat.php b/includes/compat.php index d1047df..8c274c8 100644 --- a/includes/compat.php +++ b/includes/compat.php @@ -76,3 +76,24 @@ if ( ! function_exists( 'array_is_list' ) ) { return true; } } + +if ( ! function_exists( 'str_contains' ) ) { + /** + * Polyfill for `str_contains()` function added in PHP 8.0. + * + * Performs a case-sensitive check indicating if needle is + * contained in haystack. + * + * @param string $haystack The string to search in. + * @param string $needle The substring to search for in the `$haystack`. + * + * @return bool True if `$needle` is in `$haystack`, otherwise false. + */ + function str_contains( $haystack, $needle ) { + if ( '' === $needle ) { + return true; + } + + return false !== strpos( $haystack, $needle ); + } +} diff --git a/readme.txt b/readme.txt index f31f3ab..be92893 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === ActivityPub === Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nuriapena, cavalierlife Tags: OStatus, fediverse, activitypub, activitystream -Requires at least: 4.7 +Requires at least: 5.5 Tested up to: 6.4 Stable tag: 1.3.0 Requires PHP: 5.6