diff --git a/class/mtee.php b/class/mtee.php index 1caba8a..30a2aeb 100644 --- a/class/mtee.php +++ b/class/mtee.php @@ -74,7 +74,7 @@ if (!class_exists('MTEE')) { public function is_disable($type): bool { if (isset($this->get_options()[$type]) - && $this->get_options()['asset_ver_disabled'] == 1) { + && $this->get_options()[$type] == 1) { return true; } diff --git a/class/mtee_version_setting.php b/class/mtee_version_setting.php index 6a1c46d..6cdcaf7 100644 --- a/class/mtee_version_setting.php +++ b/class/mtee_version_setting.php @@ -1,36 +1,56 @@ options = $options; - $this->change_wp_version_view(); - $this->change_asset_version_view(); - } + public function __construct($options) { + $this->options = $options; + $this->disabled_wp_version_view(); + $this->disabled_asset_version_view(); + $this->disabled_emoji(); + $this->disabled_rss_feed(); + } - public function change_wp_version_view() { - if ( $this->options['wp_ver_disabled'] == 1 ) { - remove_action( 'wp_head', 'wp_generator' ); - } - } + public function disabled_wp_version_view() { + if ($this->options['wp_ver_disabled'] == 1) { + remove_action('wp_head', 'wp_generator'); + } + } - public function change_asset_version_view() { - if ( $this->options['asset_ver_disabled'] == 1 ) { - add_action( 'wp_default_scripts', array( $this, 'remove_src_wp_ver' ) ); - add_action( 'wp_default_styles', array( $this, 'remove_src_wp_ver' ) ); - } - } + public function disabled_asset_version_view() { + if ($this->options['asset_ver_disabled'] == 1) { + add_action('wp_default_scripts', array($this, 'remove_src_wp_ver')); + add_action('wp_default_styles', array($this, 'remove_src_wp_ver')); + } + } - function remove_src_wp_ver( $dep ) { - $dep->default_version = ''; - } + public function remove_src_wp_ver($dep) { + $dep->default_version = ''; + } + public function disabled_emoji() { + if ($this->options['emoji_disabled'] == 1) { + remove_action('wp_head', 'print_emoji_detection_script', 7); + remove_action('wp_print_styles', 'print_emoji_styles'); + } + } - } + public function disabled_rss_feed() { + if ($this->options['rss_disabled'] == 1) { + //RSS Feedを停止 + remove_action('do_feed_rdf', 'do_feed_rdf'); + remove_action('do_feed_rss', 'do_feed_rss'); + remove_action('do_feed_rss2', 'do_feed_rss2'); + remove_action('do_feed_atom', 'do_feed_atom'); + //RSSリンクを無効化 + remove_action('wp_head', 'feed_links', 2); + remove_action('wp_head', 'feed_links_extra', 3); + } + } + } } \ No newline at end of file diff --git a/meta-tag-etc-extend.php b/meta-tag-etc-extend.php index be87aa6..5b15c67 100644 --- a/meta-tag-etc-extend.php +++ b/meta-tag-etc-extend.php @@ -62,10 +62,19 @@ if ($mtee->is_enable('noindex_nofollow')) { new mtee_meta_output_noindexnofollow(); } -//disabled WP version, WP JS/CSS version -if ($mtee->is_disable('asset_ver_disabled') || $mtee->is_disable('asset_ver_disabled')) { - require_once MTEE_CLASS_DIR . 'mtee_version_setting.php'; - new mtee_version_setting($options); +//disabled WP version, WP JS/CSS version, Emoji, RSS Feed +$disabled_checks = array( + 'asset_ver_disabled', + 'asset_ver_disabled', + 'emoji_disabled', + 'rss_disabled' +); +foreach ($disabled_checks as $disabled_check) { + if ($mtee->is_disable($disabled_check)) { + require_once MTEE_CLASS_DIR . 'mtee_version_setting.php'; + new mtee_version_setting($options); + break; + } } diff --git a/template/index.php b/template/index.php index ae60a71..b8753a6 100644 --- a/template/index.php +++ b/template/index.php @@ -7,6 +7,8 @@ $ogp_setting = $this->get_key_setting('ogp_setting'); $canonical_setting = $this->get_key_setting('canonical_setting'); $wp_ver_disabled = $this->get_key_setting('wp_ver_disabled'); $asset_ver_disabled = $this->get_key_setting('asset_ver_disabled'); +$emoji_disabled = $this->get_key_setting('emoji_disabled'); +$rss_disabled = $this->get_key_setting('rss_disabled'); ?>