Skip to content

Instantly share code, notes, and snippets.

View DreamerKlim's full-sized avatar
🚩
Focusing

Ivanov Klim DreamerKlim

🚩
Focusing
View GitHub Profile
/* --------------------------------------------------------------------------
* Удаляем стили css-класса .recentcomments
* -------------------------------------------------------------------------- */
add_action( 'widgets_init', 'sheensay_remove_recent_comments_style' );
function sheensay_remove_recent_comments_style() {
global $wp_widget_factory;
remove_action( 'wp_head', array( $wp_widget_factory -> widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
* Отключаем srcset и sizes для картинок в WordPress
* -------------------------------------------------------------------------- */
// Отменяем srcset
// выходим на раннем этапе, этот фильтр лучше чем 'wp_calculate_image_srcset'
add_filter('wp_calculate_image_srcset_meta', '__return_null' );
// Отменяем sizes - это поздний фильтр, но раннего как для srcset пока нет...
add_filter('wp_calculate_image_sizes', '__return_false', 99 );
/* --------------------------------------------------------------------------
* Удаляем опасные методы работы XML-RPC Pingback
* -------------------------------------------------------------------------- */
add_filter( 'xmlrpc_methods', 'sheensay_block_xmlrpc_attacks' );
function sheensay_block_xmlrpc_attacks( $methods ) {
unset( $methods['pingback.ping'] );
unset( $methods['pingback.extensions.getPingbacks'] );
return $methods;
}
/* --------------------------------------------------------------------------
* Отключаем Emoji
* -------------------------------------------------------------------------- */
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
/* --------------------------------------------------------------------------
* Удаляем опасные методы работы XML-RPC Pingback
* -------------------------------------------------------------------------- */
add_filter( 'xmlrpc_methods', 'sheensay_block_xmlrpc_attacks' );
function sheensay_block_xmlrpc_attacks( $methods ) {
unset( $methods['pingback.ping'] );
unset( $methods['pingback.extensions.getPingbacks'] );
return $methods;
}
@DreamerKlim
DreamerKlim / wp-json
Last active July 23, 2017 13:17
wp-json
/* --------------------------------------------------------------------------
* Отключаем wp-json
* -------------------------------------------------------------------------- */
// Отключаем сам REST API
add_filter('rest_enabled', '__return_false');
// Отключаем фильтры REST API
remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
remove_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
Первым делом устанавливаем / убеждаемся в наличии необходимых пакетов:
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libdigest-md5-perl
Теперь нам нужно скачать свежею версию Webmin. Так репозиторий Webmin по умолчанию не включен
нам придется его добавить, открываем файл командой:
sudo nano /etc/apt/sources.list
И в самый низ добавляем такую строчку:
deb http://download.webmin.com/download/repository sarge contrib
Сохраняем изменения Ctrl+Х и закрываем текстовый редактор редактор.
# Меняем пароль для пользователя root, вводим 2 раза один и тот же пароль
sudo passwd root
# Получаем права, вводим пароль, который прописали выше
su
# Обновление
apt-get update && apt-get -y upgrade
# Установка unzip
apt-get install -y unzip
# Переходим в директорию
@DreamerKlim
DreamerKlim / WHMCS
Last active January 30, 2017 12:50
How to install WHMCS module
1. Locate whmcs installation directory on your server
2. Create vesta directory in the modules/server subdirectory
3. Download php module
Example:
cd /home/user/web/billing-site.ltd/public_html/modules/server
mkdir vesta
wget http://c.vestacp.com/0.9.8/rhel/whmcs-module.php -O vesta.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Demystifying Email Design</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body style="margin: 0; padding: 0;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>