Files
apache
wp-content
mu-plugins
plugins
themes
upgrade-temp-backup
plugins
activitypub
assets
build
includes
activity
collection
handler
model
peer
rest
table
transformer
class-activity-dispatcher.php
class-activitypub.php
class-admin.php
class-blocks.php
class-debug.php
class-handler.php
class-hashtag.php
class-health-check.php
class-http.php
class-mention.php
class-migration.php
class-scheduler.php
class-shortcodes.php
class-signature.php
class-webfinger.php
compat.php
debug.php
functions.php
help.php
integration
templates
.distignore
LICENSE
activitypub.php
readme.txt
authldap
companion-auto-update
gp-premium
jetpack-protect
smtp-mailer
w3tc-config
index.php
.gitignore
htaccess
php.ini
laipower/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-debug.php
2024-02-08 12:31:53 +00:00

37 lines
1.1 KiB
PHP

<?php
namespace Activitypub;
use WP_DEBUG;
use WP_DEBUG_LOG;
/**
* ActivityPub Debug Class
*
* @author Matthias Pfefferle
*/
class Debug {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() {
if ( WP_DEBUG && WP_DEBUG_LOG ) {
\add_action( 'activitypub_safe_remote_post_response', array( self::class, 'log_remote_post_responses' ), 10, 4 );
}
}
public static function log_remote_post_responses( $response, $url, $body, $user_id ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r
\error_log( "Request to: {$url} with response: " . \print_r( $response, true ) );
}
public static function write_log( $log ) {
if ( \is_array( $log ) || \is_object( $log ) ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r
\error_log( \print_r( $log, true ) );
} else {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
\error_log( $log );
}
}
}