Plugin Directory

Changeset 1700941


Ignore:
Timestamp:
07/23/2017 06:28:36 AM (9 years ago)
Author:
dreamerklim
Message:

1.3.1

Location:
disable-unnecessary-functionality/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • disable-unnecessary-functionality/trunk/disable-unnecessary-functionality.php

    r1700936 r1700941  
    22/*
    33Plugin Name: Disables unnecessary functionality
    4 Plugin URI: http://pupi-boy.ru/
     4Plugin URI: https://pupi-boy.ru/wordpress/wordpress-otklyuchaem-wp-json-emoji-xml-rpc-head.html
    55Description: 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
     6Version: 1.3.1
    77Author: DreamerKlim
    88Author URI: https://pupi-boy.ru/avtor-ivanov-klim
     
    1111
    1212
    13 /*  Copyright 2017  Ivanov Klim  (email : DreamerKlim@outlook.com)
     13/* Copyright 2017  Ivanov Klim  (email : DreamerKlim@outlook.com)
    1414 
    1515    This program is free software; you can redistribute it and/or modify
     
    2929
    3030/* --------------------------------------------------------------------------
    31 *  Отключаем wp-json
     31*  Отключаем wp-json и др
    3232* -------------------------------------------------------------------------- */
     33
     34add_filter('xmlrpc_enabled', '__return_false');
     35remove_action('wp_head', 'wp_shortlink_wp_head');
     36remove_action( 'wp_head', 'rsd_link' );
     37remove_action( 'wp_head', 'wlwmanifest_link' );
     38remove_action( 'wp_head', 'wp_generator' );
     39remove_action( 'wp_head', 'feed_links_extra', 3 );
     40remove_action( 'wp_head', 'feed_links', 2 );
     41remove_action( 'wp_head', 'index_rel_link' );
     42remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head');
    3343
    3444// Отключаем сам REST API
     
    98108 
    99109 
    100  
    101  
    102110/* --------------------------------------------------------------------------
    103111 * Отключаем Emojii
    104112 * -------------------------------------------------------------------------- */
    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 );
     113remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
     114remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
     115remove_action( 'wp_print_styles', 'print_emoji_styles' );
     116remove_action( 'admin_print_styles', 'print_emoji_styles' );
     117remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
     118remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
     119remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
     120add_filter( 'tiny_mce_plugins', 'disable_wp_emojis_in_tinymce' );
     121function disable_wp_emojis_in_tinymce( $plugins ) {
     122    if ( is_array( $plugins ) ) {
     123        return array_diff( $plugins, array( 'wpemoji' ) );
     124    } else {
     125        return array();
     126    }
    116127}
    117 add_action( 'init', 'disable_emojis' );
    118 
    119 /**
    120  * Filter function used to remove the tinymce emoji plugin.
    121  *
    122  * @param    array  $plugins 
    123  * @return   array             Difference betwen the two arrays
    124  */
    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 
    151128/* --------------------------------------------------------------------------
    152129 * Отключаем Emojii
    153130 * -------------------------------------------------------------------------- */
    154 
    155131 
    156132 
     
    191167*  Удаляем опасные методы работы XML-RPC Pingback
    192168* -------------------------------------------------------------------------- */
    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 
    205169?>
  • disable-unnecessary-functionality/trunk/readme.txt

    r1678620 r1700941  
    1 === Disables unnecessary functionality ===
     1=== Disables unnecessary functionality ===
    22Contributors: DreamerKlim
    33Donate link: https://pupi-boy.ru/avtor-ivanov-klim
     
    55Requires at least: 3.7
    66Tested up to: 4.8
    7 Stable tag: 1.1
     7Stable tag: 1.3.1
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.