Files
apache
wp-content
jetpack-waf
mu-plugins
plugins
activitypub
assets
build
includes
activity
collection
handler
model
rest
scheduler
table
transformer
class-activitypub.php
class-autoloader.php
class-blocks.php
class-cli.php
class-comment.php
class-debug.php
class-dispatcher.php
class-embed.php
class-handler.php
class-hashtag.php
class-http.php
class-link.php
class-mailer.php
class-mention.php
class-migration.php
class-move.php
class-notification.php
class-options.php
class-query.php
class-sanitize.php
class-scheduler.php
class-shortcodes.php
class-signature.php
class-webfinger.php
compat.php
constants.php
debug.php
functions.php
integration
templates
LICENSE
activitypub.php
readme.txt
audioigniter
cloudron-sso
gitium
gp-premium
jetpack-protect
menu-icons
openid-connect-generic
rss-importer
simple-local-avatars
smtp-mailer
two-factor
wp-piwik
wp-webauthn
index.php
themes
w3tc-config
index.php
.gitignore
htaccess
php.ini
laipower/wp-content/plugins/activitypub/includes/debug.php

80 lines
1.9 KiB
PHP

<?php
/**
* Debugging functions.
*
* @package Activitypub
*/
namespace Activitypub;
/**
* Allow localhost URLs if WP_DEBUG is true.
*
* @param array $parsed_args An array of HTTP request arguments.
*
* @return array Array or string of HTTP request arguments.
*/
function allow_localhost( $parsed_args ) {
$parsed_args['reject_unsafe_urls'] = false;
return $parsed_args;
}
\add_filter( 'http_request_args', '\Activitypub\allow_localhost' );
/**
* Debug the outbox post type.
*
* @param array $args The arguments for the post type.
* @param string $post_type The post type.
*
* @return array The arguments for the post type.
*/
function debug_outbox_post_type( $args, $post_type ) {
if ( 'ap_outbox' !== $post_type ) {
return $args;
}
$args['show_ui'] = true;
$args['menu_icon'] = 'dashicons-upload';
return $args;
}
\add_filter( 'register_post_type_args', '\Activitypub\debug_outbox_post_type', 10, 2 );
/**
* Debug the outbox post type column.
*
* @param array $columns The columns.
* @param string $post_type The post type.
*
* @return array The updated columns.
*/
function debug_outbox_post_type_column( $columns, $post_type ) {
if ( 'ap_outbox' !== $post_type ) {
return $columns;
}
$columns['ap_outbox_meta'] = 'Meta';
return $columns;
}
\add_filter( 'manage_posts_columns', '\Activitypub\debug_outbox_post_type_column', 10, 2 );
/**
* Debug the outbox post type meta.
*
* @param string $column_name The column name.
* @param int $post_id The post ID.
*
* @return void
*/
function manage_posts_custom_column( $column_name, $post_id ) {
if ( 'ap_outbox_meta' === $column_name ) {
$meta = \get_post_meta( $post_id );
foreach ( $meta as $key => $value ) {
echo \esc_attr( $key ) . ': ' . \esc_html( $value[0] ) . '<br>';
}
}
}
\add_action( 'manage_posts_custom_column', '\Activitypub\manage_posts_custom_column', 10, 2 );