diff --git a/activitypub.php b/activitypub.php index dbca209..e0f7880 100644 --- a/activitypub.php +++ b/activitypub.php @@ -21,50 +21,50 @@ namespace Activitypub; function init() { \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|^)#(\w*[A-Za-z_]+\w*)' ); - require_once dirname( __FILE__ ) . '/includes/table/followers-list.php'; - require_once dirname( __FILE__ ) . '/includes/class-signature.php'; - require_once dirname( __FILE__ ) . '/includes/peer/class-followers.php'; - require_once dirname( __FILE__ ) . '/includes/functions.php'; + require_once \dirname( __FILE__ ) . '/includes/table/followers-list.php'; + require_once \dirname( __FILE__ ) . '/includes/class-signature.php'; + require_once \dirname( __FILE__ ) . '/includes/peer/class-followers.php'; + require_once \dirname( __FILE__ ) . '/includes/functions.php'; - require_once dirname( __FILE__ ) . '/includes/class-activity-dispatcher.php'; + require_once \dirname( __FILE__ ) . '/includes/class-activity-dispatcher.php'; \Activitypub\Activity_Dispatcher::init(); - require_once dirname( __FILE__ ) . '/includes/model/class-activity.php'; - require_once dirname( __FILE__ ) . '/includes/model/class-post.php'; + require_once \dirname( __FILE__ ) . '/includes/model/class-activity.php'; + require_once \dirname( __FILE__ ) . '/includes/model/class-post.php'; \Activitypub\Model\Post::init(); - require_once dirname( __FILE__ ) . '/includes/class-activitypub.php'; + require_once \dirname( __FILE__ ) . '/includes/class-activitypub.php'; \Activitypub\Activitypub::init(); // Configure the REST API route - require_once dirname( __FILE__ ) . '/includes/rest/class-outbox.php'; + require_once \dirname( __FILE__ ) . '/includes/rest/class-outbox.php'; \Activitypub\Rest\Outbox::init(); - require_once dirname( __FILE__ ) . '/includes/rest/class-inbox.php'; + require_once \dirname( __FILE__ ) . '/includes/rest/class-inbox.php'; \Activitypub\Rest\Inbox::init(); - require_once dirname( __FILE__ ) . '/includes/rest/class-followers.php'; + require_once \dirname( __FILE__ ) . '/includes/rest/class-followers.php'; \Activitypub\Rest\Followers::init(); - require_once dirname( __FILE__ ) . '/includes/rest/class-following.php'; + require_once \dirname( __FILE__ ) . '/includes/rest/class-following.php'; \Activitypub\Rest\Following::init(); - require_once dirname( __FILE__ ) . '/includes/rest/class-webfinger.php'; + require_once \dirname( __FILE__ ) . '/includes/rest/class-webfinger.php'; \Activitypub\Rest\Webfinger::init(); - require_once dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php'; + require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php'; \Activitypub\Rest\NodeInfo::init(); - require_once dirname( __FILE__ ) . '/includes/class-admin.php'; + require_once \dirname( __FILE__ ) . '/includes/class-admin.php'; \Activitypub\Admin::init(); - require_once dirname( __FILE__ ) . '/includes/class-hashtag.php'; + require_once \dirname( __FILE__ ) . '/includes/class-hashtag.php'; \Activitypub\Hashtag::init(); - require_once dirname( __FILE__ ) . '/includes/class-debug.php'; + require_once \dirname( __FILE__ ) . '/includes/class-debug.php'; \Activitypub\Debug::init(); - require_once dirname( __FILE__ ) . '/includes/class-health-check.php'; + require_once \dirname( __FILE__ ) . '/includes/class-health-check.php'; \Activitypub\Health_Check::init(); } add_action( 'plugins_loaded', '\Activitypub\init' ); diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index 07d9223..49e022a 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -57,14 +57,14 @@ class Activitypub { $accept_header = $_SERVER['HTTP_ACCEPT']; if ( - stristr( $accept_header, 'application/activity+json' ) || - stristr( $accept_header, 'application/ld+json' ) + \stristr( $accept_header, 'application/activity+json' ) || + \stristr( $accept_header, 'application/ld+json' ) ) { return $json_template; } // accept header as an array - $accept = \explode( ',', trim( $accept_header ) ); + $accept = \explode( ',', \trim( $accept_header ) ); if ( \in_array( 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', $accept, true ) || @@ -113,11 +113,11 @@ class Activitypub { } if ( 'publish' === $new_status && 'publish' !== $old_status ) { - \wp_schedule_single_event( time(), 'activitypub_send_post_activity', array( $post->ID ) ); + \wp_schedule_single_event( \time(), 'activitypub_send_post_activity', array( $post->ID ) ); } elseif ( 'publish' === $new_status ) { - \wp_schedule_single_event( time(), 'activitypub_send_update_activity', array( $post->ID ) ); + \wp_schedule_single_event( \time(), 'activitypub_send_update_activity', array( $post->ID ) ); } elseif ( 'trash' === $new_status ) { - \wp_schedule_single_event( time(), 'activitypub_send_delete_activity', array( get_permalink( $post ) ) ); + \wp_schedule_single_event( \time(), 'activitypub_send_delete_activity', array( get_permalink( $post ) ) ); } } diff --git a/includes/class-admin.php b/includes/class-admin.php index 51513cb..fbdf85d 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -39,14 +39,14 @@ class Admin { * Load settings page */ public static function settings_page() { - \load_template( dirname( __FILE__ ) . '/../templates/settings.php' ); + \load_template( \dirname( __FILE__ ) . '/../templates/settings.php' ); } /** * Load user settings page */ public static function followers_list_page() { - \load_template( dirname( __FILE__ ) . '/../templates/followers-list.php' ); + \load_template( \dirname( __FILE__ ) . '/../templates/followers-list.php' ); } /** diff --git a/includes/class-debug.php b/includes/class-debug.php index 5539cf6..ac8b8bf 100644 --- a/includes/class-debug.php +++ b/includes/class-debug.php @@ -21,7 +21,7 @@ class Debug { } public static function write_log( $log ) { - if ( is_array( $log ) || is_object( $log ) ) { + if ( \is_array( $log ) || \is_object( $log ) ) { \error_log( \print_r( $log, true ) ); } else { \error_log( $log ); diff --git a/includes/functions.php b/includes/functions.php index 4eeeb33..a2587ee 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -194,7 +194,7 @@ function get_identifier_settings( $user_id ) {
or