Changeset 1700941
- Timestamp:
- 07/23/2017 06:28:36 AM (9 years ago)
- Location:
- disable-unnecessary-functionality/trunk
- Files:
-
- 2 edited
-
disable-unnecessary-functionality.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
disable-unnecessary-functionality/trunk/disable-unnecessary-functionality.php
r1700936 r1700941 2 2 /* 3 3 Plugin Name: Disables unnecessary functionality 4 Plugin URI: http ://pupi-boy.ru/4 Plugin URI: https://pupi-boy.ru/wordpress/wordpress-otklyuchaem-wp-json-emoji-xml-rpc-head.html 5 5 Description: Disables unnecessary functionality: REST API, Emoji, links to the blog-clients, links to the RSS feed version of your WordPress, automatic links in comments and some other functions. 6 Version: 1.3 6 Version: 1.3.1 7 7 Author: DreamerKlim 8 8 Author URI: https://pupi-boy.ru/avtor-ivanov-klim … … 11 11 12 12 13 /* Copyright 2017 Ivanov Klim (email : DreamerKlim@outlook.com)13 /* Copyright 2017 Ivanov Klim (email : DreamerKlim@outlook.com) 14 14 15 15 This program is free software; you can redistribute it and/or modify … … 29 29 30 30 /* -------------------------------------------------------------------------- 31 * Отключаем wp-json 31 * Отключаем wp-json и др 32 32 * -------------------------------------------------------------------------- */ 33 34 add_filter('xmlrpc_enabled', '__return_false'); 35 remove_action('wp_head', 'wp_shortlink_wp_head'); 36 remove_action( 'wp_head', 'rsd_link' ); 37 remove_action( 'wp_head', 'wlwmanifest_link' ); 38 remove_action( 'wp_head', 'wp_generator' ); 39 remove_action( 'wp_head', 'feed_links_extra', 3 ); 40 remove_action( 'wp_head', 'feed_links', 2 ); 41 remove_action( 'wp_head', 'index_rel_link' ); 42 remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head'); 33 43 34 44 // Отключаем сам REST API … … 98 108 99 109 100 101 102 110 /* -------------------------------------------------------------------------- 103 111 * Отключаем Emojii 104 112 * -------------------------------------------------------------------------- */ 105 106 function disable_emojis() { 107 remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); 108 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); 109 remove_action( 'wp_print_styles', 'print_emoji_styles' ); 110 remove_action( 'admin_print_styles', 'print_emoji_styles' ); 111 remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); 112 remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); 113 remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); 114 add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); 115 add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 ); 113 remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); 114 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); 115 remove_action( 'wp_print_styles', 'print_emoji_styles' ); 116 remove_action( 'admin_print_styles', 'print_emoji_styles' ); 117 remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); 118 remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); 119 remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); 120 add_filter( 'tiny_mce_plugins', 'disable_wp_emojis_in_tinymce' ); 121 function disable_wp_emojis_in_tinymce( $plugins ) { 122 if ( is_array( $plugins ) ) { 123 return array_diff( $plugins, array( 'wpemoji' ) ); 124 } else { 125 return array(); 126 } 116 127 } 117 add_action( 'init', 'disable_emojis' );118 119 /**120 * Filter function used to remove the tinymce emoji plugin.121 *122 * @param array $plugins123 * @return array Difference betwen the two arrays124 */125 function disable_emojis_tinymce( $plugins ) {126 if ( is_array( $plugins ) ) {127 return array_diff( $plugins, array( 'wpemoji' ) );128 } else {129 return array();130 }131 }132 133 /**134 * Remove emoji CDN hostname from DNS prefetching hints.135 *136 * @param array $urls URLs to print for resource hints.137 * @param string $relation_type The relation type the URLs are printed for.138 * @return array Difference betwen the two arrays.139 */140 function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {141 if ( 'dns-prefetch' == $relation_type ) {142 /** This filter is documented in wp-includes/formatting.php */143 $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/' );144 145 $urls = array_diff( $urls, array( $emoji_svg_url ) );146 }147 148 return $urls;149 }150 151 128 /* -------------------------------------------------------------------------- 152 129 * Отключаем Emojii 153 130 * -------------------------------------------------------------------------- */ 154 155 131 156 132 … … 191 167 * Удаляем опасные методы работы XML-RPC Pingback 192 168 * -------------------------------------------------------------------------- */ 193 194 add_filter('xmlrpc_enabled', '__return_false');195 remove_action('wp_head', 'wp_shortlink_wp_head');196 remove_action( 'wp_head', 'rsd_link' );197 remove_action( 'wp_head', 'wlwmanifest_link' );198 remove_action( 'wp_head', 'wp_generator' );199 remove_action( 'wp_head', 'feed_links_extra', 3 );200 remove_action( 'wp_head', 'feed_links', 2 );201 remove_action( 'wp_head', 'index_rel_link' );202 remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head');203 204 205 169 ?> -
disable-unnecessary-functionality/trunk/readme.txt
r1678620 r1700941 1 === Disables unnecessary functionality ===1 === Disables unnecessary functionality === 2 2 Contributors: DreamerKlim 3 3 Donate link: https://pupi-boy.ru/avtor-ivanov-klim … … 5 5 Requires at least: 3.7 6 6 Tested up to: 4.8 7 Stable tag: 1. 17 Stable tag: 1.3.1 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.